Autarky is a minimalist PHP framework for self-sufficient programmers. It doesn't hold your hand and doesn't put restrictions on you, and is aimed at experienced developers and quick learners. It's designed for the perfect balance between flexibility, enabling rapid development, and clean object oriented programming.
Heavily inspired by Python's Flask, Autarky is a stripped down implementation of all the best features of various PHP projects. I hope you'll find that it's less invasive, more loosely coupled and less bloated than other frameworks, but is still intuitive and makes it easy to get started on new projects quickly.
Autarky is currently at version 0.x, which means breaking changes can happen as according to SemVer's 4th rule.
Goals and vision
The main goal of the framework is to provide a thin, unopiniated routing and dependency injection layer that wraps around Symfony's HttpFoundation component. Anything that goes on beyond the routing is entirely up to the programmer - you simply map URLs to classes and methods, the configurable dependency injecting container resolves these classes and calls the methods, and the return value is turned into a HTTP response.
The framework does not come with a database layer, mail library, cache layer, authentication service, queue services, translation service and so on. The implementation and integration of these are entirely left up to you, whether you want to write them yourself or pick a third party library, all you should need is a service provider class that binds the services to the container and you're good to go.
Key features and design concepts include:
- No procedural code, everything can be wrapped in classes and callbacks
- Intelligent service/dependency injection container - automatic dependency injection via typehinting in constructor parameters, powerful factory definitions
- Utilizes Composer for package management and autoloading
- Utilizes Symfony's HttpFoundation for easy handling of responses and requests as well as session management
- Comes with an implementation of nikic's FastRoute, a very performant router
- Application-level middleware using StackPHP
- Seamless integration with Twig, the most robust and mature templating engine available in PHP
- Connection manager for management and lazy instantiation of PDO objects
- Easily testable - implementing HttpKernelInterface means you can utilize Symfony's BrowserKit and DomCrawler components, which makes system-level/functional testing a breeze. Check out an example.
Creating a project
This repository contains the framework's core classes and tests. To create a new project using Autarky, we need to use Composer:
composer create-project autarky/skeleton -s dev --prefer-dist /path/to/project
This will set up a minimalist project for you to build on top of. You can show the demo page in your browser by setting up PHP's built-in web server and open "localhost:8000" in your favourite browser:
php -S localhost:8000 -t /path/to/project/web
Keep in mind that during version 0.x, breaking changes may happen as the minor version increments. The Github releases page contains upgrade instructions and changelogs.
Autarky is hosted on Github. The main repository is autarky/framework - please use this repository for reporting issues. See the repository/repositories CONTRIBUTING file for more information.
Feel free to open an issue on Github if you have any problems or suggestions. Alternatively (or additionally), you may want to ask on Stack Overflow using the "autarky" tag.
Contact Andreas Lutro personally for potential security issues.
The contents of this repository is released under the MIT license.