My talk was on the use of Swagger and the OpenAPI Specification to document REST APIs. The talk was hosted by the MadisonPHP user group.
I created this graphic as a simple way to visualize dependency injection, unit testing and the use of php interfaces. The interface provides the “agreement/contract” between the implementations and class \ControllerForExample. You can see that $httpClient can be any one of the implementations. \ControllerForExample doesn’t need to know the details of each implementation, only that the contract/implementation is valid.
There was a great discussion on Composer and the use of Packagist.org for dependency management. Often times a software project has a list of dependencies upon which the project depends. Composer allows the developer to manage these dependencies using a json file (composer.json). A simple composer.json file might include a few specific dependencies at specific versions. Previously PEAR was used to handle software installation, but Composer has simplified and expanded dependency management.
There was another talk on moving from Legacy code to Modern code. This was an exciting discussion on refactoring code, unit testing and continuous integration. This was exciting, heady stuff! The writing of unit tests during refactoring made sense, and we will strive to tackle this daunting task on Legacy projects. Unit tests are essentially tests against one’s code. We make certain assumptions that X function/method should return Y. Unit tests ensure that these assumptions don’t break when refactoring code. There are many cases for using unit tests right away and PHPUnit has great documentation on useage.
Well, these were just two of the many discussions we attended last year. We are excited to attend this year’s 2014 conference at the Alliant Energy Center in Madison.
Nice article on Kitchen Gallery in Madison Magazine. Love this store. Good photo of the WI Cook with Pride skillet too:…