2

PHP gurus / masochists.

I've been using Symfony components for new, isolated features in a legacy php application for awhile now. the time has come to integrate using the kernel, and routing for new endpoints while existing endpoints use the existing apache means of loading pages.

It's not my first rodeo doing this, but I'd appreciate any wisdom/resources/patterns you followed for anyone who's had to do the same.

My clients don't have the means to do hire the appropriate ammount of devs to do a proper port, so this is a long path towards modernization by ceasing to bolt on features to existing code and instead, when working on something, updating it to the new design pattern and then extending that, with a spec, documentation and code coverage.

Comments
  • 1
    we did it too. symfony over yii. we made a bundle as the bridge between new and the legacy.
  • 0
    @r4ccoon Right, this is the approach I'm seeing detailed in various examples.

    The legacy app uses a mess of a bootstrap file which includes a config file, full of defined constants, and then a bunch of classes as globals which are used throughout. classes and global methods access & change those globals.

    I've managed to prove we can move the defined constants file into a new, lightweight bootstrap file, just autoloading and namesspace configuration (like doctrine annotations)

    The new bootstrap file is used for phpunit, standalone console component commands, and standalone ajax endpoints I've been using.

    I've refactored the session & auth code, which was necessary to write new, secure ajax with csrf & admin area session login checking.

    I've been thus far using my own controller classes to organize business logic away from the templates (all existing pages do php calls followed by html stew)...all endpoints had to live in the root web directory because of relative path fuckery
  • 0
    we have the legacy system in vendor folder, and for the constants, we have define it in listener in the legacy bundle.
Add Comment