$30 off During Our Annual Pro Sale. View Details »

Framework agnostic packages for the win (ForumPHP 2015)

Framework agnostic packages for the win (ForumPHP 2015)

Jonathan Reinink

November 24, 2015
Tweet

More Decks by Jonathan Reinink

Other Decks in Technology

Transcript

  1. View Slide

  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.

    View Slide

  3. View Slide

  4. What exactly does
    framework agnostic mean?

    View Slide

  5. Code that works
    independent of
    frameworks.

    View Slide

  6. Framework agnostic
    does not mean
    framework intolerant.

    View Slide

  7. Why framework agnostic?

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  11. As software become
    increasingly more complex,
    our reliance on existing,
    quality code increases.

    View Slide

  12. I see a future where the
    various PHP communities
    more actively share code
    with one another.

    View Slide

  13. So, why then are we
    using framework
    specific code?

    View Slide

  14. Because we sort of had to.

    View Slide

  15. 1994 - 2004:
    2005 - 2012:
    2013 - Future:
    Vanilla PHP
    Frameworks
    Packages

    View Slide

  16. 1994 - 2004:
    The age of vanilla PHP

    View Slide

  17. Rasmus started
    working on PHP
    sometime in 1994.

    View Slide

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

    View Slide

  19. PHP became a career
    for many of us.

    View Slide

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

    View Slide

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

    View Slide

  22. Routing
    Templating
    Database Abstraction
    Validation
    Session Handling
    Error Management
    Authentication
    Caching
    Request Processing
    Responses Sending

    View Slide

  23. Developers starting
    writing new, focused
    PHP libraries.

    View Slide

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

    View Slide

  25. So we manually
    downloaded zip files.

    View Slide

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

    View Slide

  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.

    View Slide

  28. PEAR had some issues...

    View Slide

  29. The community
    gave up on PEAR. :(

    View Slide

  30. 2005 - 2012:
    The age of frameworks

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  34. Frameworks allowed us
    to get work done quickly.

    View Slide

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

    View Slide

  36. But, what if the framework
    didn't have some other
    functionality you needed?

    View Slide

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

    View Slide

  38. We continued to
    download zip files. :(

    View Slide

  39. Then everything
    changed.

    View Slide

  40. 2013 - Future:
    The age of packages

    View Slide

  41. 1994 - 2004:
    2005 - 2012:
    2009:
    2012:
    2013 - Future:
    Vanilla PHP
    Frameworks
    PHP-FIG Formed
    Composer Launched
    Packages

    View Slide

  42. View Slide

  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)

    View Slide

  44. “To define standards that
    help developers write
    portable and reusable code.”
    (PEARs goal)

    View Slide

  45. Their very first recommendation
    was an autoloading standard
    called PSR-0.

    View Slide

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

    View Slide

  47. www.php-fig.org

    View Slide

  48. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  54. So, why are we still
    using frameworks?

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  58. Need something your
    framework doesn’t offer?
    No worries, just:
    > composer require the/package

    View Slide

  59. Even frameworks are now
    being built using
    framework agnostic code.

    View Slide

  60. Framework agnostic
    code also pulls
    communities together.

    View Slide

  61. Framework agnostic
    code is good for
    package maintainers.

    View Slide

  62. If you’re a maintainer of a
    framework specific package,
    please consider making it
    framework agnostic.

    View Slide

  63. This will require a change in
    thinking. We’ve been in the
    age of frameworks a long time.

    View Slide

  64. Offer framework specific
    support for your package
    using service providers.

    View Slide

  65. View Slide

  66. phppackagechecklist.com

    View Slide

  67. View Slide

  68. So, why
    framework agnostic?

    View Slide

  69. BECAUSE IT CAN BE!!!

    View Slide

  70. Thanks!
    Follow me on Twitter at @reinink.
    Rate this talk https://joind.in/15278.

    View Slide