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

The art of PHP package design

The art of PHP package design

Are you dreaming about your first project? Maybe you already have several under your belt? When it comes to making you project user-friendly and usable, writing code is only one of the things you must care about. The rest of them is covered in this talk.

Tomasz Kowalczyk

October 10, 2016
Tweet

More Decks by Tomasz Kowalczyk

Other Decks in Programming

Transcript

  1. the art of
    package
    design
    in PHP

    View Slide

  2. /usr/bin/whoami
    @tmmx

    View Slide

  3. View Slide

  4. Idea

    View Slide

  5. “I want to create a new library!”
    Why?

    View Slide

  6. searching for ideas

    View Slide

  7. research current state

    View Slide

  8. pain points

    View Slide

  9. rule of three

    View Slide

  10. finishing your tasks
    solving problems

    View Slide

  11. “There are only two hard things in
    Computer Science: cache invalidation and
    naming things.”
    Phil Karlton

    View Slide

  12. Code

    View Slide

  13. project repository

    View Slide

  14. GitHub,
    BitBucket,
    Gitlab...

    View Slide

  15. ...self hosting?

    View Slide

  16. SourceForge
    PHPClasses

    View Slide

  17. composer.json

    View Slide

  18. supported PHP versions

    View Slide

  19. dependencies

    View Slide

  20. roave/security-advisories

    View Slide

  21. depend in the
    direction of stability

    View Slide

  22. PSR-0 vs PSR-4

    View Slide

  23. consistent coding style

    View Slide

  24. framework agnostic

    View Slide

  25. now comes
    the best part

    View Slide

  26. CODE
    CODE
    CODE
    CODE
    CODE
    code
    code
    code
    code
    code
    Code
    Code
    Code
    Code
    Code
    CODE
    code

    View Slide

  27. Continuous Integration

    View Slide

  28. because you
    have tests,
    right?

    View Slide

  29. RIGHT?

    View Slide

  30. license

    View Slide

  31. to GPL, or not to GPL?

    View Slide

  32. MIT, BSD,
    Apache, MPL,
    WTFPL

    View Slide

  33. do not use
    Creative Commons

    View Slide

  34. versioning scheme

    View Slide

  35. SemVer
    major.minor.patch

    View Slide

  36. breaking news! changes

    View Slide

  37. tagging releases

    View Slide

  38. README.md

    View Slide

  39. Release

    View Slide

  40. register package

    View Slide

  41. Composer
    Packagist
    Satis

    View Slide

  42. Final touch

    View Slide

  43. CHANGELOG.md

    View Slide

  44. .gitattributes

    View Slide

  45. .gitignore

    View Slide

  46. SensioLabs Insight
    Scrutinizer CI
    Nitpick CI

    View Slide

  47. Community

    View Slide

  48. documentation

    View Slide

  49. CONTRIBUTING.md

    View Slide

  50. Summary

    View Slide

  51. my condolences, you’re
    now the maintainer of
    an open source project!

    View Slide

  52. Images
    https://www.flickr.com/photos/davidedamico/15030329393 (city bg)
    https://www.flickr.com/photos/skyseeker/14404947216 (lightning)
    Resources:
    http://www.phptherightway.com
    http://phppackagechecklist.com
    http://semver.org
    https://blog.codinghorror.com/rule-of-three
    http://martinfowler.com/bliki/TwoHardThings.html
    https://en.wikipedia.org/wiki/Software_versioning
    https://en.wikipedia.org/wiki/Comparison_of_free_and_open-source_software_licenses
    https://gist.github.com/jashkenas/cbd2b088e20279ae2c8e
    https://leanpub.com/principles-of-package-design
    https://www.sitepoint.com/starting-new-php-package-right-way
    https://runcommand.io/2016/06/26/my-condolences-youre-now-the-maintainer-of-a-popular-open-source-project
    http://www.slideshare.net/matthiasnoback/principles-of-php-package-design-for-amsterdamphp
    http://raphaelstolt.blogspot.com/2016/09/anatomy-of-dope-php-package-repository.html

    View Slide

  53. Questions?

    View Slide

  54. Thanks!
    @tmmx

    View Slide