Features of an Exceptional Framework
There are a lot of PHP frameworks out there. Still, we created yet another one. And we think we did it right.
We do not think Flow is the one and only framework for everyone to solve all problems once and for all. But if you are working on complex projects, we think Flow is worth a look and will probably help you solve your task better than other frameworks.
All in all it boils down to: You write your code, Flow does most of the rest.
Model View Controller (MVC) is a pattern which clearly separates information, representation and mediation into separated building blocks. Although the design pattern and its naïve implementation are relatively simple, Flow, being a capable MVC framework, also takes care of more complex tasks such as input sanitizing, validation, form and upload handling and much more.
Property Mapping & Validation
Flow goes far beyond what PHP offers in terms of handling incoming data. When a request arrives, it contains all its data as simple types, that is strings, and arrays. Instead of burdening you with manually mapping that data to objects, Flow transparently converts the incoming data to its correct object representation by looking at your actions typehints, giving you ready to use objects.
Validation is a crucial topic in web applications: Almost all data which is coming in through a request needs some checking. While validation itself is usually quite simple, embedding it into the rest of the framework is not: If a wrong value comes in, often the original page has to be re-displayed, together with well-readable information on what went wrong. Validation will be done automatically, based on your code documentation and can be extended with custom validators if needed.
Convention over configuration is one key principle of Flow. Your templates are at the usual location? Your validators follow the naming conventions? Repositories and models are at the expected places? Then there is no need to configure anything. Flow goes even further - it reads as much as possible from source code documentation blocks to configure validation, persistence, session handling, AOP, DI, … Because we believe configuration should never be a burden.
For a framework aimed at building web applications, a fundamental building block must be clean and stable HTTP support. Flow fulfills that requirement with an implementation that follows the relevant RFCs closely, to provide standards-compliant HTTP interaction for your applications. At the same time the API that is exposed lowers the barriers to correct use of cache control, cookie handling and more significantly. All this makes it easier than ever to cleanly interact with HTTP clients and servers alike.
Dealing with static and dynamic resources, like images, stylesheets or any user uploads is not an easy task. Just think about content delivery networks, or security implications, or optimizing CSS and JS assets. Flow encapsulates resource handling and publishing and thus allows to change the publication process and other parts of a resource lifecycle without impacting your application.
In a complex application, dependencies between parts of the codebase are always an issue. To manage that, decoupling is key and Dependency Injection, reversing the roles in satisfying dependencies, makes that a breeze. And with Flow, contrary to other DI solutions in the PHP world, configuration is optional thanks to advanced auto-wiring.
Things like security and logging are important, but when it comes to your source code, they are usually cluttering up things more than they should. One way to move those so-called cross-cutting concerns to a central place is Aspect-Oriented Programming. Flow is the only AOP framework for PHP that works without the need for extensions and works with pure PHP. All the needed background work happens automatically and is completely transparent to the developer. Still, all the power one can expect from AOP is readily available…
Existing template engines often lack means to produce templates that are valid XML, allow the direct use of PHP (thus opening up holes for security issues) and do not easily support the use of objects. Fluid, the templating engine created for Flow, remedies those shortcomings. On top of that it is extremely extensible, fast and flexible. Did we already mention it is easy to use as well?
A really good framework is a framework that keeps itself in the background. It should allow you to focus on the problem you are solving, and that rarely is related to persistence, security or logging. Instead you should be able to focus on the business logic, on the things that compose the domain of the problem at hand. Domain-Driven Design (DDD) is an excellent approach to foster that, and Flow is the only PHP framework that specifically supports DDD.
Security is a central concern in most applications, but Flow is the only framework offering an approach that accommodates that. Using policies defined in simple YAML files it is possible to limit access to methods and data in any application without touching the actual code to add security checks.
Session handling can be complex and it is easy to get lost in implementation details. Flow makes using sessions as easy as possible by providing a session scope for objects. All you need to do is mark an object as being in session scope and you can use it just like a "singleton that survives over request borders". No further details you need to care about.
Deployment, data import and export, setup – anything you want to automate profits from being doable from the command line. With Flow, command line use is at the heart of the system. Full help for all commands, standard unix-like behavior and an incredibly easy way to create your own command line controllers are there for you to work with.
Internationalization & Localization
The ability to translate users interfaces and adapt to local requirements is crucial for web applications, being implicitly targeting a world-wide audience. Flow offers features to translate labels used in your application as well as use static resources like images depending on the currently active locale.
Error & Exception Handling
Even with Flow providing exceptional ease of use for the developer, errors will happen. So we took great care to provide stack traces that are as helpful as possible and give you flexible logging possibilities.
Testing & Debugging
During the work on Flow we live and breathe test-driven development (TDD). And because we believe it is a crucial building block in providing reliable software, we want you to make use of TDD as well. That is why our base testcases for unit and functional testing provide a number of useful helpers to ease testing of Flow applications. And for serious debugging we took steps to support xdebug even though Flow does some pretty complex code-munging in the background.
Speed & Performance
Any framework introduces overhead of some sort. So does Flow. But speed is a manyfold factor in a project. The speed of executing a single request is important, but so is the ability to serve under the load of many concurrent requests. The speed, with which an application can be developed is also an important factor for most projects. Memory consumption can make an otherwise fine framework unusable for certain scenarios. That is why we took great care to make development with Flow easy and fast - and optimize execution speed and memory consumption for production use.