symphony process
Share on facebook
Share on twitter
Share on linkedin

Are you using ‘exec’, ‘passthru’, ‘shell_exec’ and ‘system’ php functions in your Laravel project?

Taking care of security risks by yourself, as well as expecting differences per operating system which project runs on?

Seems like it’s time to review Symfony Component ‘Process’, which allows you to handle things outside of project way easier, with high input-output control, and it’s escaping arguments to prevent security issues.

It comes with features like:

  • real-time Process Output,
  • Exception handling
  • Running Processes Asynchronously,
  • Setting Environment Variables for Processes,
  • Streaming to the Standard Input of a Process,
  • Using a Prepared Command Line,
  • wait() function,
  • Process Timeout,
  • Process Signals

Which gives you complete control over process you are running on server.

 

I found it’s great usage while handling the feature where I had to run specific python file, which required passed arguments:

 

 

Official documentation for this component: https://symfony.com/doc/current/components/process.html

Then, it’s time to go for it:

But before you do, also review Terminal, which is an elegant wrapper around the Symfony Process Component:

https://github.com/TitasGailius/terminal

 

0 0 vote
Article Rating

Subscribe to our newsletter

Be first to read new helpful post

Share this post with your friends

Share on linkedin
Share on xing
Share on twitter
Share on facebook

And the winners are …

As already announced we are going to launch 42workflows in the near future – a free open source package that will help you automate your

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments