Version 0.9.3 released
In the following I will go through the changelog of the 0.9.3 release of PSX and explain more detailed about the changes and the reasoning behind it.
Added commands to generate boilerplate source code for controller, commands and schema
In order to speedup development PSX now includes commands which can generate source code. Here as example an command call howto generate a new controller:
$ ./vendor/bin/psx generate:controller Acme\News connection,http
This would generate the file Acme\News.php in the library folder and inject the connection and http service.
When the default writer gets determined it respects now the list of supported writers
You can set the writers which are supported by your controller through overwriting the getSupportedWriter method. Previously the default writer does not look at the list instead it always returned the JSON writer. Now the default writer must be in the list of supported writers. By this you can force a controller to use only a specific writer.
Implemented priority queue to give reader and write a priority in which order they get used
When adding a reader or writer you can pass a priority value. The priority value specify the traversal direction. I.e. the XML reader gets applied for every +xml content type so a custom reader for handling an specific xml content type must be added before the xml reader.
Changed default html template file extension from .tpl to .html
This change is a major break since all template files must end now with
.html. This was done because we have added a new SVG writer which also uses the template engine. In order to distinct between the templates each template file must now have the file extension of the associated content type. I.e. the HTML writer has
.htmland the SVG writer
Added abstract template writer which can be used to generate an output with an template engine
The abstract temlate writer simplifies the process of creating a new writer for an specific content type using an template engine. The HTML and SVG writer extend also from the abstract template writer.
Added svg writer which uses the abstract template writer
An SVG writer was added to create an SVG presentation of your data
Add possibility to set an content negotiation rule for an specific writer
It is now possible to set an custom content negotiation rule. I.e. if you want that all image requests are handeled by the SVG writer you could add the following content negotiation rule:
For every Accept header which has image as type i.e.
image/webp, etc. the SVG writer gets used.
Restricted the TableInterface::TYPE_* constants to the subset of supported types from the doctrine dbal and use the dbal for type conversion
To support also different database vendors the table class uses now only a subset of the available mysql types. This subset are the types which are also supported by the dbal across all database vendors.
Added command to generate an bootstrap cache which can be included at startup to increase performance
A command was added which can generate a file containing all PSX classes which are needed for every request. This could increase the performance of the application since the classes must not be autoloaded. This makes only sense if you are _not_ using an bytecode cache which is included in HHVM or PHP 5.5.0 also the bootstrap cache complicates debugging. To use the cache you must include the generated bootstrap file in your index.php.