Pro Yearly is on sale from $80 to $50! »

Roll your own micro framework

Roll your own micro framework

Are micro frameworks the future? When you choose a framework your often have to make compromises and you couple your code to the framework itself. Let’s explore how we can create our own micro framework we can tailor for our application’s needs and how it fits well in a service oriented architecture.

E308353d68158f1741677735b0548233?s=128

Niklas Modess

September 07, 2015
Tweet

Transcript

  1. Roll your own micro framework

  2. Me, myself & I Niklas Modess Remote freelancer / consultant

    Organizer of Laravel Stockholm meetup group Author of Deploying PHP Appplications Blogger at http://modess.io @niklasmodess
  3. Framework (de)coupling

  4. SHOTS FIRED, COMMENCE FLAME WARS!

  5. Service oriented architecture (Micro Services)

  6. Simple RESTful API with Laravel? 4 classpreloader/classpreloader 4 danielstjules/stringy 4

    doctrine/inflector 4 jeremeamia/superclosure 4 league/flysystem 4 monolog/monolog 4 mtdowling/cron-expression
  7. 4 nesbot/carbon 4 psy/psysh 4 swiftmailer/swiftmailer 4 symfony/console 4 symfony/css-selector

    4 symfony/debug 4 symfony/dom-crawler 4 symfony/finder
  8. 4 symfony/http-foundation 4 symfony/http-kernel 4 symfony/process 4 symfony/routing 4 symfony/translation

    4 symfony/var-dumper 4 vlucas/phpdotenv
  9. S.O.L.I.D 4 Single responsibility principle 4 Open/closed principle 4 Liskov

    substitution principle 4 Interface segregation principle 4 Dependency inversion principle
  10. Inversion of Control IoC

  11. instead of this... <?php use MicroFramework\Router; $router = new Router;

    // some code.. $router->dispatch();
  12. we do this... <?php $container = require __DIR__ . '/bootstrap.php';

    $router = $container->get('Router'); // some code.. $router->dispatch();
  13. Let's build stuff 4 Application container (DI/IoC) 4 Router interface

    4 Router implementations 4 Hot-swapping router implementations