cape-dev/php-framework

A lightweight PHP web application framework for rapid development (routing, DI, database, views, console, caching).

Maintainers

Package info

github.com/joel767443/cape-dev-framework

Type:project

pkg:composer/cape-dev/php-framework

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.3 2026-03-17 18:15 UTC

This package is auto-updated.

Last update: 2026-03-17 18:23:50 UTC


README

A lightweight custom PHP backend (routing + middleware + DI + validation + migrations) with a server-rendered landing page.

What’s included (backend)

  • Routing: Symfony Routing (symfony/routing) via routes/api.php + src/Http/Kernel.php
  • HTTP layer: Symfony HttpFoundation (symfony/http-foundation)
  • DI container: PHP-DI (php-di/php-di) + service providers (src/Providers/*)
  • Validation: Symfony Validator (symfony/validator) + App\Requests\FormRequest
  • Database: Eloquent/Illuminate Database (illuminate/database) + migrations (php run migrate)
  • ORM (optional): Doctrine ORM (doctrine/orm) with php run doctrine:schema:update
  • Outbound HTTP: Guzzle (guzzlehttp/guzzle) via WebApp\Http\Client\HttpClient
  • Auth: JWT (firebase/php-jwt) middleware alias auth_jwt + token endpoint POST /api/auth/token
  • Queue: custom Redis queue + optional Symfony Messenger (symfony/messenger)
  • Logging: Monolog (monolog/monolog)
  • Testing: PHPUnit + Pest
  • Extras: Dotenv, Carbon (now()), UUID (uuid())

Installation + quickstart

Start the backend

chmod +x bin/dev
./bin/dev

One-word CLI (php run)

run still works, but you can also run the console as:

php run
php run route:list
php run dev

Backend (PHP)

composer install

# start HTTP server (from repo root)
php -S localhost:8001 -t public public/index.php

Open http://localhost:8001/ for the landing page, or http://localhost:8001/docs for docs.

API endpoints (current routes)

Routes are defined in routes/api.php.

Method Path Description
POST /api/auth/token Issue a JWT token
GET /api/secure/ping JWT-protected example endpoint
POST /api/validate Validation example (returns validated payload or 422)

Backend architecture (source of truth)

  • Entrypoint: public/index.php loads routes from routes/api.php (and routes/web.php) and runs WebApp\Application.
  • HTTP kernel: src/Http/Kernel.php matches routes (Symfony Routing), runs middleware, invokes controllers, and enforces that controllers return a Symfony\Component\HttpFoundation\Response.
  • Middleware: global middleware is wired in src/Application.php. Route middleware is attached per route (or via Router::group()) and resolved via src/Http/Middleware/MiddlewareRegistry.php.
  • Validation: request validation is Symfony Validator via App\Requests\FormRequest + WebApp\Validation\RequestValidator. If a controller action type-hints a FormRequest, it is automatically validated by the kernel before the controller runs.
  • Database: configured in config/database.php and wired via src/Providers/DatabaseServiceProvider.php (Illuminate Database / Eloquent).
  • Migrations: discovered in app/Database/Migrations and run via php run migrate.

CLI (run)

php run route:list
php run make:request StoreItemRequest
php run make:migration create_items_table
php run migrate

Docs