Hello World! Antidot Framework

Kpicaza
PHP FAD
Published in
4 min readJun 3, 2020

Antidot framework(@antidotframewo1) was born as an exercise to learn and understand the inner workings of the different components that are common in professional development tools.

Let me put you in context. I’m self-taught, my first contact with a PHP framework was in 2013 with Codeigniter, Then, Symfony2, also at work we had to deal with Zend Framework 1, who’s been with me for several years, Laravel, Slim, and finally my favorite, Zend Expressive.

Having seen several generations of frameworks, I will explain why Zend Expressive(now Mezzio) is my favorite framework. It’s the only framework that allows us to select among the implementations of the key pieces that are most convenient or best suited to our project, as it conforms to the PSR standards accepted by most of the PHP community. It defines a set of rules that makes all the code framework agnostic. I mean that we can run the same code in any other PHP Framework with a minimum of effort.

The only issue I see with it is its learning curve since it involves selecting different implementations for components that a junior programmer does not have to understand at first contact.

So, my idea was to craft a framework following the same paradigm as Mezzio without the need of a too pronounced learning curve.

From this premise, the Antidot Framework was born with the idea of applying the same paradigm as Mezzio, adding a standard installation. To simplify the configuration and the injection of dependencies, trying to take advantage of the things I like best from the different frameworks I know, and above all learn how the pieces of the most used professional tools work.

Well, no more boring stories;-D. I’m going to introduce you to their features.

Features

The standard configuration is very light, only needs 33 packages in production mode, and is designed to develop long-time distributed applications, API or CLI style, and is easy to deploy as a monolith or microservices, even as a serverless application.

The main characteristics of the framework are the following:

It adopts the standards of coding and self-loading classes, PSR-1, PSR-2, and PSR-4, it comes with Grumphp configured, with Phpunit and Phpstan to ensure optimal code quality before each commit.

Dependency injection with auto wiring, which makes it very easy to start knowing and taking advantage of concepts like dependency inversion,
or just not caring too much about how to build the classes.

For HTTP applications, adopt the PSR-15 standard using the Http Request Handler Runner component, with a pipeline routing implementation inspired by the Mezzio Framework and Slim.

I focus the configuration design on simplicity and flexibility, friendly to integrate third-party libraries, and lets to the choice between PHP or YAML in the style of Symfony.

It comes configured with a PSR-14 Event Dispatcher implementation that can easily use to distribute domain or application events, and a PSR-3 log system with Monolog and the integration library wshafer/psr11-monolog.

Finally, it comes with an implementation of the Symfony console tool and the Antidot Dev Tools component that contains several useful commands for generating code templates, enabling development mode, config caching, and so on.

Conclusion

In my opinion, this project is a collection of concepts that I have been learning over the years using the popular frameworks day by day.
I made it with all my love, and currently, it has only just been born. The next steps are: to continue completing documentation, create and build different adapters for the most used libraries, and of course, keep meeting people, learning, and enjoying my work.

A special mention to the creators of Mezzio(formerly Zend Expressive), because they have inspired this project. Another salute to co-workers at Uvinum, twitter friends, Larry Garfield(@crell) for your constructive criticism on the implementation of the Antidot Event Dispatcher component, and especially to Marc Morera(@mmoreram), a private conversation with you made this project public ;-).

I want to add that I’d love to get your feedback, PRs, advice, and so on, I will be happy to listen and discuss both on Github and Twitter.

Thank you very much for reading this post and sharing Antidot Framework. The story just started.

See the docs if you want to start using Antidot Framework.

Happy Coding!

--

--