Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Framework agnostic packages for the win (ForumPHP 2015)

Framework agnostic packages for the win (ForumPHP 2015)

Jonathan Reinink

November 24, 2015

More Decks by Jonathan Reinink

Other Decks in Technology


  1. None
  2. 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.
  3. None
  4. What exactly does framework agnostic mean?

  5. Code that works independent of frameworks.

  6. Framework agnostic does not mean framework intolerant.

  7. Why framework agnostic?

  8. Framework agnostic code is more reusable than framework specific code.

  9. Reusable code is code we don't have to write.

  10. I believe creating reusable code is key to the continued

    success of PHP.
  11. As software become increasingly more complex, our reliance on existing,

    quality code increases.
  12. I see a future where the various PHP communities more

    actively share code with one another.
  13. So, why then are we using framework specific code?

  14. Because we sort of had to.

  15. 1994 - 2004: 2005 - 2012: 2013 - Future: Vanilla

    PHP Frameworks Packages
  16. 1994 - 2004: The age of vanilla PHP

  17. Rasmus started working on PHP sometime in 1994.

  18. PHP was this new amazing tool that let us build

    dynamic websites easily.
  19. PHP became a career for many of us.

  20. We started finding ways to write code better and faster.

  21. PHP had a decent standard library, but pieces were missing.

  22. Routing Templating Database Abstraction Validation Session Handling Error Management Authentication

    Caching Request Processing Responses Sending
  23. Developers starting writing new, focused PHP libraries.

  24. But…we had no easy way to share them.

  25. So we manually downloaded zip files.

  26. Introducing PEAR: PHP first attempt at a package manager.

  27. 1. To provide a consistent means for library code authors

    to share their code with other devs. 2. To give the PHP community an infrastructure for sharing code. 3. To define standards that help developers write portable and reusable code. 4. To provide tools for code maintenance and distribution.
  28. PEAR had some issues...

  29. The community gave up on PEAR. :(

  30. 2005 - 2012: The age of frameworks

  31. Reusable code was packaged up into libraries called frameworks.

  32. Frameworks were easy to download, and they just worked.

  33. Frameworks came with almost everything needed for the average project.

  34. Frameworks allowed us to get work done quickly.

  35. 2015 became the year of PHP frameworks. Symfony, CakePHP, Solar,

    Agavi, ezComponents
  36. But, what if the framework didn't have some other functionality

    you needed?
  37. Frameworks grew to accommodate a wide range of use cases.

  38. We continued to download zip files. :(

  39. Then everything changed.

  40. 2013 - Future: The age of packages

  41. 1994 - 2004: 2005 - 2012: 2009: 2012: 2013 -

    Future: Vanilla PHP Frameworks PHP-FIG Formed Composer Launched Packages
  42. None
  43. “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)
  44. “To define standards that help developers write portable and reusable

    code.” (PEARs goal)
  45. Their very first recommendation was an autoloading standard called PSR-0.

  46. The PHP-FIG continues to develop standards that make sharing reusable

    code easier.
  47. www.php-fig.org

  48. None
  49. Unlike PEAR, Composer got a LOT of things right.

  50. Downloaded packages. Resolved their dependencies. Autoloaded classes.

  51. Composer was exactly what PHP needed to solve it's code

    sharing problem.
  52. Composer was an overnight success, and became mainstream in 2013.

  53. Packages starting popping up everywhere. It was amazing!

  54. So, why are we still using frameworks?

  55. In the age of packages, the purpose of frameworks is

  56. Frameworks no longer have to be everything to everyone.

  57. Frameworks are now the glue between reusable framework agnostic packages.

  58. Need something your framework doesn’t offer? No worries, just: >

    composer require the/package
  59. Even frameworks are now being built using framework agnostic code.

  60. Framework agnostic code also pulls communities together.

  61. Framework agnostic code is good for package maintainers.

  62. If you’re a maintainer of a framework specific package, please

    consider making it framework agnostic.
  63. This will require a change in thinking. We’ve been in

    the age of frameworks a long time.
  64. Offer framework specific support for your package using service providers.

  65. None
  66. phppackagechecklist.com

  67. None
  68. So, why framework agnostic?


  70. Thanks! Follow me on Twitter at @reinink. Rate this talk