Zero dependencies
No package manager required to run the core. What ships is what runs, nothing pulled in behind the scenes.
01 PHP 8.5+ · Zero dependencies
Barephrame is a PHP framework built for fast, dependency-free API development. Compiled routes and its own ORM. Nothing you didn't ask for, nothing hidden underneath.
// philosophy
It shouldn't be required to load thousands of dependencies just to create an API.
That's the whole idea behind Barephrame. The core is small enough to read in an afternoon and simple enough to extend without fighting it — override the parts you need, leave the rest exactly as it is.
02 — Spec sheet
Four load-bearing decisions the rest of the framework is built around.
No package manager required to run the core. What ships is what runs, nothing pulled in behind the scenes.
Connect to Postgres, MySQL, or Firebird through one consistent connection layer.
Routes compile ahead of time via the CLI instead of being resolved fresh on every single request.
Built specifically for Barephrame, talk to different database engines with a consistent syntax.
03 — Mechanism
Barephrame reads native PHP attributes to know what an endpoint is, which HTTP method it answers to, and what runs before it. No routing files to keep in sync by hand.
GET when omitted./v{n}.:name in the path is passed to the method, in order, as a typed argument.Changed a route? Run --compile-routes, or keep --watch running while you build.
// /App/users/Users.php
namespace App\users;
use Barephrame\Attributes\Method;
use Barephrame\Attributes\Route;
use Barephrame\Core\Request\Request;
class Users {
#[Route('/users')]
public function ListAllUsers() {}
#[Method('POST')]
#[Route('/users')]
public function CreateUser() {}
#[Route('/users/:code')]
public function GetUserData(
Request $request,
string $code
) {}
}
04 — Documentation
The documentation is small on purpose. Here's the short version of each sheet — the full set lives in the repository.
Every endpoint is a plain method carrying a #[Route] attribute. Nothing is discovered until it's compiled — that's what keeps response times down.
#[Route('/path')] is required; without it, the method is invisible to the router.#[Method('POST'|'PUT'|'PATCH'|...)] overrides the default of GET.#[Version(n)] prefixes the route with /v{n}.#[Route]; the controller only runs once every middleware returns a 200.Request object is always available as the first parameter, but it's optional to type-hint it.// requires all middlewares to validate correctly before the controller runs
#[Route('/users/:code', JWTMiddleware::class, RoleMiddleware::class)]
#[Version(3)]
public function GetUserData(Request $req, int $code) {}
// resolves to GET /v3/users/:code
Connections run through PDO under a single DatabaseTypes enum, so switching engines never means changing connections.
Connections::mainConnection() reads straight from the [Database] block in app.ini.Connections::use($keyname) retrieves an already-open connection by name from anywhere in the app.DatabaseResult; call close() once you're done with it.$connection = Connections::mainConnection(DatabaseTypes::POSTGRES);
$sql = $connection->statement('SELECT * FROM users WHERE id > :ID');
$sql->parameters->ID = 1000;
$result = $sql->execute();
$sql->close();
Everything routine goes through Barephrame/cli/tools.php. Flags chain together, so there's rarely a reason to run two commands separately.
--init scaffolds the initial project structure without touching files that already exist.--compile-routes precompiles every discovered endpoint once.--watch checks every second for changed endpoints and recompiles automatically — development only.# scaffold, then keep routes compiled while you work
php ./Barephrame/cli/tools.php --init
php ./Barephrame/cli/tools.php --watch
05 — Revision history
Barephrame V2 is the fourth revision of the same idea, not a fresh start. Every prior version was rebuilt — sometimes renamed entirely — as I learned more about what a framework like this should actually do.
# clone, scaffold, and compile routes
git clone https://github.com/Angel-del-dev/barephrame-V2.git my-api
cd my-api
php ./Barephrame/cli/tools.php --init --watch