webpagestudio / wps-micro-skeleton
Application skeleton for the WPS Micro framework
Package info
github.com/Victor8730/Wps-Micro-Skeleton
Type:project
pkg:composer/webpagestudio/wps-micro-skeleton
Requires
- php: ^8.3
- webpagestudio/wps-micro: ^3.0@dev
Requires (Dev)
- phpunit/phpunit: ^12.5
README
Application skeleton for building sites with the WPS Micro framework.
Requirements
- PHP 8.3 or higher
- Composer
- Node.js 20.19 or higher and npm
- Docker and Docker Compose for the bundled environment
Create An Application
composer create-project webpagestudio/wps-micro-skeleton my-site
cd my-site
cp .env_example .env
npm ci
npm run build
The application depends on webpagestudio/wps-micro, so framework releases can
be installed without replacing application controllers, models, routes, views,
or migrations:
composer update webpagestudio/wps-micro
Run Locally
With Docker:
docker compose up --build
Then open http://localhost.
With PHP's built-in server:
php -S localhost:8000 -t public public/index.php
The sample application uses a database. When PHP runs outside Docker, configure
DB_HOST=127.0.0.1 and the forwarded MariaDB port in .env; the default
mariadb hostname resolves only inside the Compose network.
Application Structure
app/Controllers- HTTP controllersapp/Middleware- application middlewareapp/Models- persistence modelsapp/Services- business workflowsbootstrap/app.php- framework bootstrapconfig/app.php- application and infrastructure configurationdatabase/migrations- ordered database migrationsroutes/web.php- explicit web routesresources/views- Twig layouts, pages, partials, and macrosresources/css,resources/js- Vite and Tailwind entry pointspublic- the only web-accessible directorystorage- generated caches and logstests- application testswps- console entry point
Console
php wps php wps make:controller Product php wps make:model Product php wps make:migration create_products_table php wps migrate php wps migrate:rollback
Generated classes use the application namespace and never modify the installed
framework package under vendor/.
Routes
Register routes in routes/web.php:
use App\Controllers\ControllerProduct; use WpsMicro\Core\Router; return static function (Router $router): void { $router->get('/products/{id}', [ControllerProduct::class, 'actionShow']); $router->post('/cart/add', [ControllerCart::class, 'actionAdd']); };
Views
Controllers render templates from resources/views:
return $this->render('products/show.twig', [ 'product' => $product, ]);
Templates can extend layouts and include reusable partials:
{% extends 'layouts/app.twig' %}
{% block content %}
{% include 'products/_card.twig' with { product: product } %}
{% endblock %}
Production
Create the production environment and start the immutable images:
cp .env.production.example .env.production docker compose --env-file .env.production -f docker-compose.production.yaml up -d --build
The production Dockerfile builds frontend assets and Composer dependencies in separate stages. The final images contain only runtime application files.