A working scaffold for a standalone PHPNomad MVC application. No WordPress, no Symfony framework, no host platform. Just PHPNomad running directly behind an index.php entrypoint, with routing wired through phpnomad/fastroute-rest-integration, templates through phpnomad/twig-integration, events through phpnomad/symfony-event-dispatcher-integration, caching through phpnomad/symfony-cache-integration, configuration through phpnomad/json-config-integration, and error pages through filp/whoops. Clone it, install dependencies, point a web server at index.php, and you have a running PHPNomad app to start modifying.
This repository is not published on Packagist, so clone it directly.
git clone https://github.com/phpnomad/mvc-app-template.git my-app
cd my-app
composer installFor local development, PHP's built-in server works.
php -S localhost:8000 index.phpPoint any other web server (Apache, Nginx, Caddy) at index.php as the front controller.
index.phpis the front controller. It registers Whoops, builds theApplication, wires config files, and dispatches the request as aRequestInitiatedevent.app/Application.phpruns a two-phase bootstrap. The first pass loads core PHPNomad integrations (config, core, events, REST). The second pass loads your app's ownInitializer.app/Initializer.phpis where you bind concrete strategies and providers to PHPNomad interfaces and register routes from config.app/Strategies/contains aCachePolicythat reads from config, aPathResolverthat resolves asset paths relative toindex.php, and aCurrentContextResolverStrategythat detects Rest vs Web requests.app/Auth/PassthroughUser.phpis a no-auth placeholderUserimplementation. Replace it when you need real authentication.controllers/HomeController.phppluscontrollers/Services/RenderableResponseService.phpshow a sample controller and the service that bridges controllers and the Twig renderer.configs/app.jsonandconfigs/cache.jsonhold routes and cache settings as JSON, loaded throughphpnomad/json-config-integration.public/contains a base Twig layout, header/footer/sidebar components, a landing page atpublic/index.twig, and adist/styles.cssstylesheet.
- Composer
- A PHP runtime that satisfies the dependency tree
- A web server (or PHP's built-in server) pointing at
index.phpas the front controller
Framework documentation lives at phpnomad.com. The bootstrapping guide there explains the initializer and loader patterns this template is built on.
MIT. See LICENSE.