Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Framework agnostic packages for the win (SkiPHP...

Framework agnostic packages for the win (SkiPHP 2016)

Jonathan Reinink

January 15, 2016
Tweet

More Decks by Jonathan Reinink

Other Decks in Technology

Transcript

  1. Jonathan Reinink Software developer from Canada. Been writing PHP for

    over 15 years. Marketing agency for over a decade. Started contract development this year. I <3 open source.
  2. We're seeing a huge shift to creating smaller pieces of

    focused, reusable "framework agnostic" code.
  3. "You should be using best of breed stuff, you shouldn't

    have to use the stuff that came with your framework if there is better stuff out there; it should just drop in.” — Rob Allen
  4. “We're a group of established PHP projects whose goal is

    to talk about commonalities between our projects and find ways we can work better together.” (PHP-FIG goal)
  5. namespace Psr\Log; interface LoggerInterface { public function emergency($message, array $context

    = []); public function alert($message, array $context = []); public function critical($message, array $context = []); public function error($message, array $context = []); public function warning($message, array $context = []); public function notice($message, array $context = []); public function info($message, array $context = []); public function debug($message, array $context = []); public function log($level, $message, array $context = []); }
  6. “A huge part of the PHP Renaissance has been due

    to the advent of Composer, which has simplified dependency management, and led to tens of thousands of standalone libraries and packages.” (continued)
  7. “As such, frameworks, while still popular, are often being eschewed

    for homemade, application-specific frameworks made of commodity components. Frameworks simply cannot ignore this trend, and decoupling should become the norm going forward.”
  8. “Today, even competing frameworks make liberal use of each other’s

    components, because the PHP community at large has adopted a culture of sharing and of working together.” — Heroku (blog)
  9. "You will probably see more use-case specific skeletons come into

    the Zend Framework world.” — Rob Allen
  10. "Lumen 5.2.0 marks a shift to exclusively focusing on stateless

    APIs with Lumen for better definition between two frameworks.” - Taylor Otwell
  11. Puli aims to replace "bundles", "plugins", "modules" and similar specialized

    packages of different frameworks with one generic, framework independent solution.
  12. use Illuminate\Support\ServiceProvider; use Services_Twilio; class TwilioServiceProvider extends ServiceProvider { public

    function register() { $this->app->singleton(Services_Twilio::class, function ($app) { return new Services_Twilio( env('TWILIO_SID'), env('TWILIO_TOKEN') ); }); } }
  13. $server = League\Glide\ServerFactory::create([ // File system abstraction 'source' => new

    Filesystem(new Local('path')), // Image processor abstraction 'driver' => 'imagick', // HTTP messages interface (PSR-7) 'response' => new PsrResponseFactory( new Response(), function ($stream) { return new Stream($stream); } ), ]);
  14. { "name": "league/glide-cake", "description": "Glide adapter for CakePHP", "require": {

    "cakephp/cakephp": "^3.0", "league/glide": "^1.0" }, "require-dev": { "phpunit/phpunit": "^4.0" }, "autoload": { "psr-4": { "League\\Glide\\": "src/" } } }
  15. It’s good for package maintainers. It’s good for other developers.

    It’s good for frameworks. It’s good for PHP.