Repository navigation
Home
A zero-dependency PHP web framework. One folder in your project, no composer install, no build step: drop it in, point index.php at it, and you have routing, a query builder, an ORM, a dependency container, middleware, events, background work, migrations, an audit log and an error page that tells you what went wrong.
Requires PHP 8.1 or newer. MySQL or SQLite.
Put blink anywhere in your project. core is the usual spot:
site/
index.php
config.define.php
config.php
routes/web.php
classes/
core/ <- blink
// index.php
require_once "core/setup.php";// config.define.php
class CONFIG extends CoreConfig {}// config.php
CONFIG::$APP_NAME = "My Site";
CONFIG::$DEBUG = true;
CONFIG::$DB_DRIVER = "SQLite3";
// or MySQL:
// CONFIG::$DB_DRIVER = "MySQLi";
// CONFIG::$DB_HOST = "127.0.0.1";
// CONFIG::$DB_USER = "site";
// CONFIG::$DB_PASS = "secret";
// CONFIG::$DB_NAME = "site";
CONFIG::$MODULES = array( App\AppModule::class );// routes/web.php
use Blink\Http\Router;
Router::GET("/", fn () => "hello");
Router::GET("/user/{id}", function (int $id) {
return App\Model\User::getByID($id, Blink\Model::MUST_EXIST);
});That is a working site. Blink creates its own data/ directory, applies its schema on the first request, and writes a .gitignore if the project has none.
The console lives alongside:
php core/blink list
php core/blink terra:status
php core/blink route:list
| Modules | How an application wires itself into blink |
| Autoload | How a class name becomes a file |
| Configuration | Every CONFIG setting |
| Essence | The dependency container |
| Ether | Middleware, around the router, queries, events and the error page |
| Router | Routes, requests and responses |
| Query Engine | The query builder |
| Model | The ORM |
| Lightrail | The event bus |
| Console | Commands, and writing your own |
| Terra | Schema and migrations |
| Files | Stored files, dedup and file stores |
| Ticker | Background work and scheduling |
| Trace | The audit log |
| Lock | Named locks across processes |
| Error Page | Reports, tips and context |
Two processes beyond the web server, both optional until you use them:
* * * * * cd /var/www/site && php core/blink ticker:tick >> /dev/null 2>&1
php core/blink ticker:run
php core/blink ticker:run lightrail
The first fires recurring work once a minute. The second drains the task queue; the third is for background and batched event handlers, which go to their own queue.
Turn CONFIG::$DEBUG off. Reports still capture what failed and error:list still finds them; the page simply stops showing anything a stranger holding the report id should not see.