http-kernel
Functional-core-imperative-shell
http-kernel | Functional-core-imperative-shell | |
---|---|---|
6 | 4 | |
8,043 | 91 | |
0.2% | - | |
9.2 | 0.0 | |
about 12 hours ago | almost 2 years ago | |
PHP | ||
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
http-kernel
-
Reading bundle configuration inside Symfony Compiler Passes
The compiling of the extension configurations is actually done in a compiler pass. This is called the Merge Pass and is the first compiler pass to be processed. Because of this, once our custom compiler pass reads the configuration of off the extension, we can be sure it is already compiled, cached and ready for use.
-
95% final readonly classes. What is your superpower?
I present you the Symfony ControllerEvent, final class, no interface and a boatload of heavy dependencies.
-
How do you test your code ?
In that regard, someone posted symfony's test suite as an example of good PHPUnit testing. The first file I clicked on demonstrated how worthless (IMO) unit testing can be: https://github.com/symfony/http-kernel/blob/v6.0.8/Tests/CacheClearer/ChainCacheClearerTest.php
-
What to do when it is necessary to modify code in a library managed by a package manager?
The second one was in the Symfony HTTP kernel which is managed by Composer. That file contains this line:
-
How to create a basic Symfony app with routing?
You can also define routes in the method directly:
Functional-core-imperative-shell
-
Unit testing tips by examples in PHP
I usually formulate this as lifting side-effects up in the stack trace. Done well you end up with functional core, imperative shell.
-
How do you test your code ?
The pattern functional core, imperative shell will help you make bigger chunks of your code-base be unit testable without database or file scaffolding.
-
Some notes on composability
[1]: Functional core, imperative shell
-
Why Dependency Injectiondi
Better summary than I could provide: https://github.com/kbilsted/Functional-core-imperative-shell/blob/master/README.md
What are some alternatives?
http-foundation - Defines an object-oriented layer for the HTTP specification
Amazon Web Service SDK - Official repository of the AWS SDK for PHP (@awsforphp)
console - Eases the creation of beautiful and testable command line interfaces
unit-testing-tips - Unit testing tips by examples in PHP
translation - Provides tools to internationalize your application
Symfony Panther - A browser testing and web crawling library for PHP and Symfony
event-dispatcher - Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
Pest - Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
Guzzle - Guzzle, an extensible PHP HTTP client
Laravel - Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.
routing - Maps an HTTP request to a set of configuration variables