Version 0.9.2 released
In the following I will go through the changelog of the 0.9.2 release of PSX and explain more detailed about the changes and the reasoning behind it.
Integrated JMS serializer
Since PSX had no special handling for serializing arbitrary objects we integrated the great JMS serializer library. There is a new
Serializerservice which can be used inside the controller to serialize an array of objects i.e. from an doctrine repository. Also you can pass the API Version object which then makes use of the versioning feature of the JMS serializer.
Removed payment and handler classes
Previously PSX contains some classes to handle payment processing. I have moved these classes into its own repository since they are not related to the framework.
Regarding the handler classes PSX had some interfaces which describe methods for retrieval and manipulation of data. These interfaces were similar to an doctrine repository except that you could also create, update and delete data. The idea was that you could build automatically an API based on such an handler. After long thinking and working with theses interfaces I came to the conclusion that they not add a real value to the framework. This is because normally you have already your own "Manager" or "Repsoitory" in your business logic which contains methods for retrieval and manipulation. In this case you would need to duplicate the code in such and handler. So it makes more sense to call these methods inside the API controller. Because of that I have removed these classes.
Added symfony console component and added several commands
For all CLI interaction we have implemented the symfony command system which makes it easy to write simple commands for reading and writing data to the CLI. We have implemented some commands which i.e. output all registered services from the DI container, display all available routes or event take an HTTP request per stdin and return the response.
Note PSX has also an "command" system but this is actually very different to the symfony command system. The difference is that an symfony command directly handles input and output of the CLI where an PSX command is more like an controller but without the request context. So the PSX command is not bound to the CLI context it can also be executed from the web or any other context. We have build an symfony command which triggers an psx command by accepting an JSON string containing the needed parameters which is useful for i.e. an message queue system.
Http client removed parameters from the http request object
We are closely following the PSR-7 standard which describes an common set of interfaces to describe HTTP messages. In fact we are already implementing version 0.2 of the specification. In order to align more to the specification we have removed some configuration parameters from the HTTP request object and created an
Optionsobject which now contains theses informations.
Moved creation of the DI container into its own file
Previously in PSX the DI container was defined in the index.php. Since we need the DI container also in other places like for the CLI or the tests we created a simple file container.php which returns the DI container. This file gets used everywhere so if you want to change the implementation you could easily change it in one place.
Dispatch events at key locations
PSX dispatches now events through the symfony event dispathcer in various key locations. In example when an request arrives at the application, an route was found or an response get sent to the user. All available events can be found at the
Eventclass. This should help to make the framework more extensible.