PDC for PHP

PDC for PHP

Learn how PDC, a smart little worker that checks on your PHP source code's class dependencies, can help to save precious software development time.

To find out more about PDC, visit https://github.com/packfire/pdc

Sam-Mauris Yong

November 30, 2012

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

10 slides
  1. PDC for PHP Smart little worker that checks on your

    PHP source code's class dependencies. Sam-Mauris Yong HeartCode Singapore [email protected] http://mauris.sg/ @_mauris 1 Dec 2012 Sam-Mauris Yong 1
  2. What is PDC? • Packfire Dependency Checker • Minimal CLI

    tool written in PHP • Class dependency problems in PHP • Generates a little report 1 Dec 2012 Sam-Mauris Yong 2
  3. Checks for… • Unused use statement; • Missing declaration of

    a class being used; • Namespace that doesn't exist according to PSR-0; • Files without namespace declaration. 1 Dec 2012 Sam-Mauris Yong 3
  4. Why PDC? • Classes are loaded real-time with autoloaders. •

    Misspelled namespaces or classnames undetected. • Difficult to check until execution • IDEs do not report such errors. 1 Dec 2012 Sam-Mauris Yong 4
  5. Reporting $ php pdc.phar src Packfire Dependency Checker Tool Written

    by Sam-Mauris Yong v1.0.1 [src/Packfire/helper.php]: Warning: no namespace found. [src/Packfire/constants.php]: Warning: no namespace found. [src/Packfire/Cache/MemCache.php]: Not found: \Memcache Time: 0.60394 seconds Completed. Summary: 300 files 2 warnings 1 dependency not found 1 Dec 2012 Sam-Mauris Yong 5
  6. Writing better codes • Saves time – Debugging – Manually

    checking • Can be attached to Continuous Integration build jobs: Automation! 1 Dec 2012 Sam-Mauris Yong 6
  7. Usage • One argument to determine source code destination. $

    php pdc.phar src 1 Dec 2012 Sam-Mauris Yong 7
  8. Usage with Travis-CI • Add following to .travis.yml config file:

    • Reports will generate after PHPUnit on Travis-CI. after_script: - "wget --quiet http://mauris.sg/bin/pdc.phar && php pdc.phar src" 1 Dec 2012 Sam-Mauris Yong 8

More Decks by Sam-Mauris Yong

Other Decks in Programming