Download the PHP package minimal/framework without Composer
On this page you can find all versions of the php package minimal/framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package framework
Minimal Framework
Please acknowledge that this is solely a Tech/Skill Demo. It is not intended for use in actual projects, although it is fully functional and tested under PHP 7.
Minimal is a MVC web application framework for PHP.
The code snippet demonstrates a monolithic approach to the framework, employing facades to define a single-function web application endpoint. There is much more than static classes under the hood! It is an efficient solution for developing small REST APIs. The framework automatically converts ORM returned data (models implementing the JsonableInterface) into JSON, streamlining the API response process. Conversely, the framework accommodates alternative setup familiar in other frameworks, supporting a traditional modular MVC architecture for more complex, larger-scale projects.
...and if you're not happy with the Router (or any other component), you could do:
...yes, SOLID principles.
CLI
Introduction
Key features:
- Build MVC-, REST-, CLI-APIs and apps and query databases with a ORM
- Take advantage of inversion of control and facades
- Easy install via command line and works out of the box
- No dependencies to third party libraries (except in development mode: PHPUnit, Symfony VarDumper)
- Most of the core components work standalone
- Plain PHP in the views/templates
Requirements
- PHP version 7.x
- composer
Install
With the default directory structure:
Then point your server's document root to the public directory.
If you use the PHP-builtin webserver then do:
Vendor libraries only:
Minimal installation for code style like in the introduction above:
Usage
CLI
Quickstart example
CLI
Routing
Direct output:
http://localhost/hello/julien/duseyau -> Hello Julien Duseyau
Using controllers
or
http://localhost/hello/julien/duseyau -> Hello Julien Duseyau
Route groups
File download
Single route execution from anywhere
CLI
Dependency injection
Binding a interface to a implementation is straight forward:
or in config/bindings.php
CLI
Providers
Providers are service providers
or in config/providers.php
CLI
Middlewares
Standalone example
CLI
Controllers
The controllers specified in the routes are instantiated through Provider->make() (e.g. App::make()), which will always look for a singleton first, then search the service container for a provider or factory or else just create a instance and inject dependencies. Which means there is nothing to do to make this controller with concrete dependencies work:
In order to use interfaces, bindings have to be registered. See also config/bindings.php
For a more control register a factory. See also config/providers.php
CLI
Views
Result:
Where to do these View calls? Anywhere is fine. But one place could be:
then
CLI
Assets
Outputs:
CLI
CLI
List all registered routes
List all registered modules
List all registered bindings
List all registered providers
List all events and subscribers
List all registered config
CLI
Components
Minimal requires at least these packages:
- judus/minimal-collections - a simple iterator
- judus/minimal-config - handles a multidimensional array
- judus/minimal-controllers - the frontcontroller
- judus/minimal-http - request and response objects
- judus/minimal-middlewares - a unconventional middleware implementation
- judus/minimal-minimal - the application object that binds all together
- judus/minimal-provider - service provider and dependency injector
- judus/minimal-routing - the router
These packages are also included but are not necessary:
- judus/minimal-assets - register css and js during runtime, dump html link and script tags
- judus/minimal-benchmark - this "benchmarking" class is only used in the demo
- judus/minimal-cli - a command line interface, which will be completely redone asap
- judus/minimal-database - a pdo connector, a mysql query builder and a ORM
- judus/minimal-event - a simple event dispatcher
- judus/minimal-html - for now just a html table class
- judus/minimal-log - a simple logger
- judus/minimal-paths - might help creating paths and urls
- judus/minimal-translation - translations in a pretty printed json file
- judus/minimal-views - simple php views and layouts
License
The Minimal framework is open-sourced software licensed under the MIT license
CLI
All versions of framework with dependencies
minimal/assets Version v0.1.4
minimal/benchmark Version v0.1.2
minimal/cli Version v0.2.0
minimal/database Version v0.1.8
minimal/html Version v0.2.0
minimal/minimal Version v0.5.0
minimal/paths Version v0.1.7
minimal/presenters Version v0.1.1
minimal/translation Version v0.1.3
minimal/views Version v0.1.4