Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9300409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:46:24+00:00 2026-06-18T22:46:24+00:00

How can I make Symfony2 run certain Commands every time the page loads when

  • 0

How can I make Symfony2 run certain Commands every time the page loads when it is in the Dev environment?

We use TypeScript and I have build a command which will grab all of my TypeScript and compile it. The only problem is, I have to do this manually every time I upload some new code, which slows things down when debugging (I’m perfectly fine doing it this way for Production though).

I’d like it to call that Command every page load (if some of the files have changed since it last compiled… all logic I’ll built out). I just need to know where I should hook in to.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T22:46:25+00:00Added an answer on June 18, 2026 at 10:46 pm

    If you are set on using Symfony to compile your TypeScript I would try using an event listener

    You could try something like this (untested):

    Add a service to the config_dev.yml file so that the listener only runs in the dev environment

    # app/config/config_dev.yml 
    services:        
          compileTypeScript:
            class: myApp\TypescriptBundle\Controller\TypescriptComiler
            tags:
                - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 64 }
    

    I’m not exactly sure how priority works, but 64 seemed to hit the sweet spot for me.

    Create the class you referenced above and add in your code to compile the TypeScript.

    //Class
    class TypescriptCompiler extends controller
    {
        public function onKernelRequest(GetResponseEvent $event)
        {       
            // compile your TypeScript here
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I make symfony completion in bash? Have ubuntu 9.10. It's hard to
I can make batch or vbs file on windows and run. this can automate
Can someone tell me how I can make the following output? I have a
After a fresh symfony2 install i can run phpunit -c app/ and phpunit tests
I'm building a RESTful service in Symfony2, using the FOSRestBundle. I can track page
I am learning how to make a basic Blog in Symfony2 and have come
when i tried to use symfony2 doctrine reverse engineering tools, I have a one
I want to make a status page for my application using symfony2 where I
Hello I am working with Symfony2 and Doctrine and I can not make a
I´m currently developing a web site using Symfony2. On 'dev' environment everything works just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.