Framework for transitioning a bespoke application

45 views
Skip to first unread message

Paul Waring

unread,
Aug 31, 2015, 11:18:42 AM8/31/15
to ph...@googlegroups.com
I'm currently working on a medium-sized bespoke PHP application (tens of
thousands of lines of code) which has been built up over 7+ years. At
some point I'd like to move this over to a framework, mainly so that
things like changes to the models (e.g. a user) don't have to be made in
half a dozen places (database, form template, PHP processing, client
side validation etc.). I'd also like things like CSRF protection to be
built-in instead of having to remember to add them to every form.

However, I've noticed that most of the PHP frameworks seem to assume
that you will use them exclusively and do everything the way they want.
This is great for new projects, or existing applications which can be
ported in one go, but not so much for larger applications where a
gradual transition is needed.

Is there a good framework out there which caters for this scenario? I'm
sure I'm not the only developer in this position. :-)

Thanks

Paul

--
Paul Waring
Freelance PHP developer
http://www.phpdeveloper.org.uk

Tim Langley

unread,
Aug 31, 2015, 2:17:42 PM8/31/15
to ph...@googlegroups.com
Symphony or Zend2 are very modular

Sent from my iPhone so please excuse typos adn brevity

Tim Langley
+44 7989 539363
> --
> --
> You received this message because you are subscribed to the Google
> Groups "PHPNW" group.
> Post to list: ph...@googlegroups.com
> Unsubscribe: phpnw+un...@googlegroups.com
> Archive: http://groups.google.com/group/phpnw?hl=en
>
> PHPNW Website: http://phpnw.org.uk/
> twitter: http://twitter.com/PHPNW
> Events: http://upcoming.yahoo.com/group/4709/
> LinkedIn: http://www.linkedin.com/e/gis/112906/3FCE41597A1B
> Facebook: http://www.facebook.com/group.php?gid=17897252075
> IRC: #phpnw (irc.freenode.net)
>
> ---
> You received this message because you are subscribed to the Google Groups "PHPNW" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to phpnw+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sam Tuke

unread,
Aug 31, 2015, 5:26:12 PM8/31/15
to ph...@googlegroups.com, Tim Langley
Right, Symfony 2 has a components system, that allows you to use certain parts in isolation. I think Silex may give you an example of a microframework built using these components.

I've also had Slim and Phalcon recommended to me on the ##php channel, and both look interesting.

Personally I like the Symfony components system, but using them may convince you, as it did me, to use more and more of them, edging you towards the whole framework. At least with the components you remain ultimately independent and free to include other libs without (hopefully) too much work.

Best,

Sam.
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Ashley Broadley

unread,
Sep 1, 2015, 4:25:10 AM9/1/15
to ph...@googlegroups.com, Tim Langley
I second the Symfony 2 components. I definitely recommend using the http-foundation component for $request & $response objects.
I usually do routing myself and find use in other components (such as silexphp/pimple for dependancy injection) for a range of things.

Hopefully you're aware of composer (if not, https://getcomposer.org/ best thing since sliced bread!), which has pretty much every PHP component worth using listed.

Ta,

Ash

Matthew Setter

unread,
Sep 30, 2015, 6:44:26 AM9/30/15
to PHPNW, pa...@phpdeveloper.org.uk
Hi Paul,

Mate that's a good question you've asked. And the replies which have already been posted are definitely on the money. I'd like to suggest a couple of things. Firstly, as you've suggested, gradually porting, or refactoring, is a solid approach. If you want an excellent talk on refactoring, Steps Toward Modernizing a Legacy Codebase, by Paul M. Jones, truly is worth watching (over and over again). 

Regarding a specific framework, especially with the uptake of PSR-7, and the increasingly universal approach of the better frameworks to be composed of components, instead of taking a monolithic approach, I don't believe you need to pick one framework. You can pick a PSR-7 implementation and then, via Composer/Packagist, bring in the other components you need, as you need them. 

This can be a combination of components from the larger, more notable frameworks, such as Zend Framework 2, and Symfony 2, or those from Silex etc. I love this approach, as it allows you to keep your application small, tight, and focused. You only need to use as much as is required. I took this approach on a recent project, using the Slim microframework as my base, and have enjoyed much success with it.

I'd love to hear how you get on.

Matt
Reply all
Reply to author
Forward
0 new messages