News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Marc Morera:
Bye Bye Symfony
September 04, 2014 @ 12:41:00

In his most recent post Marc Morera says bye bye to Symfony and "hello to PHP". Confused? His point is that using the Symfony components as a whole in the framework isn't the only option anymore. You can use them just as effectively as pieces of a larger PHP project, puling them in as needed.

The reason of this post is just to tell you, with a simple example, how to say Bye Bye, Symfony! and say Hi PHP!. This really means uncouple from Symfony Components and still use them as the default implementation, while we can securely remove, from the composer require block, our Symfony dependencies.

He starts off with a simple example showing how to use Symfony's "UrlGeneratorInterface" to create a URL output class that can be injected to use in the route handling of the application. He then moves on to a more real-life example (a metaphor) using a USB connection and the adapters/cables that could be involved to connect various devices. He then shifts back over to the world of code and describes a specification interface that can be used with the URL generation and remove the Symfony dependency from it. On top of this he builds an adapter object that brings the Symfony component back into the picture and abstracts it out a level to make for more flexibility and testability in the long run.

We win maximum implementation flexibility and minimum coupling. Would be wise to say that a PHP project should tend to this thought, but once again, it depends on many factors. [...] Using ports and adapters is really a great tool for those who want to uncouple from implementations and a great pattern if you develop open source. Open source should satisfy as people as possible, so remember, specify and then implement.
0 comments voice your opinion now!
symfony component abstract tutorial interface specification

Link: http://mmoreram.com/blog/2014/09/01/bye-bye-symfony/

blog comments powered by Disqus

Similar Posts

Robert Basic's Blog: Debugging two PHP projects in Netbeans at the same time

Klaus Graefensteiner's Blog: Two ways to test for prime numbers in PHP: Sieve and File

PHPMaster.com: Maven and PHP

NetTuts.com: Protect a CodeIgniter Application Against CSRF

SitePoint PHP Blog: Easy Wins For More Performant PHP


Community Events





Don't see your event here?
Let us know!


laravel series deployment framework tips podcast interview release threedevsandamaybe list voicesoftheelephpant symfony bugfix development api community zendserver introduction language code

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework