from Scotland Using PHP since 2001 PHP community guy, internals, and @dr4goonis php.net PHP- FIG VÍTOR BRANDÃO VÍTOR BRANDÃO PPI co-lead dev Born in ☼ Portugal, currently in ☂ England bundles, , 2PHP ports QA at @noiselabs NoiseLabs Consulting Ltd Sf2 ZF2 Python Gentoo Linux
their mind on what they want Step 5: the tool you chose in the beginning, is no longer the most relevant one Step 6: you can't switch because you're locked into that vendor Step 7: you stick with the tool because it's too di cult to switch to the correct tool
1-to-1 relationship between your app and the framework vendor. You are tightly coupled to the framework that your app was built on. You can't move your code between your Symfony apps and Laravel apps
but, you can use it like a framework Really, it's a framework delivery engine It delivers core parts of frameworks to your app Individually, to the modules of your app
PPI AS? An engine that you can boot() up. This engine can be called as middleware, or booted, from inside existing apps i.e: Wordpress, Drupal, Legacy App A command line app A full-stack framework to dispatch() HTTP requests
You only need to add what you need composer.json "ppi/smarty-module": "~1.0", "ppi/twig-module": "~1.0", "ppi/mustache-module": "~1.0" "ppi/laravel-routing": "~1.0" "ppi/aura-routing": "~1.0" "ppi/symfony-routing": "~1.0" "ppi/datasource-module": "~1.0", // LaravelDB, Eloquent, Doctrine ..etc "ppi/cache-module": "~1.0"
usage for these standards. We built our own interop layers rst, then backport them to PHP-FIG. A friendly environment for swappable 3rd-party components.
You can easily add more libraries into the mix when they implement a PSR. When consuming frameworks like (ZF2, SF2, Aura2) - that don't support PSR-X yet - PPI bridges the gap for you.
"~1.0" } PPI/Framework/Http/Request.php use Psr\Http\Message\RequestInterface; use Symfony\Component\HttpFoundation\Request as SymfonyHttpRequest; /** * HTTP messages consist of requests from a client to a server and * responses from a server to a client. This interface defines the * methods common to each. */ class Request extends SymfonyHttpRequest implements RequestInterface { public function withBody(StreamInterface $body) { $new = clone $this; $new->stream = $body; return $new; } }
composer.json: <?php namespace Application\Controller; use PPI\Framework\Module\Controller as BaseController; use Psr\Http\Message\RequestInterface; class Mycontroller extends BaseController { public function indexAction(RequestInterface $request) { if ('POST' === $request->getMethod()) { // do POST stuff } } }
as BaseServiceManager; /** * ServiceManager implements the Service Locator design pattern. * * The Service Locator is a service/object locator, tasked with retrieving other * objects. We borrow this one from Zend Framework 2. */ class ServiceManager extends BaseServiceManager implements ContainerInterface { /** * Register a service with the locator. */ public function set($name, $service, $shared = true) { return $this->setService($name, $service, $shared); } }
(Routing PSR?). Mediate routing and request information from PPI to Aura (for example). If a Routing PSR is created, we get to throw away a lot of code
PROJECT & YOUR TEAMS You no longer need a narrow skillset, but nd good developers You become exposed to new frameworks and new toolsets You are exible and not bound to one single stack You take your code from project to project with ease .. so much more ..