nations-original/php-simple-framework-template

Maintainers

Package info

github.com/Ondottr/PHP_SF_Template

Type:project

pkg:composer/nations-original/php-simple-framework-template

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 1

v1.0.0 2026-03-29 10:19 UTC

README

The official project template for PHP Simple Framework. Bootstrap a full working application in one command.

Package: nations-original/php-simple-framework-template License: ISC Author: Dmytro Dyvulskyi — CEO & Lead Developer, Nations Original

Documentation

Full documentation is available at wiki.nations-original.com/framework.

Section Topics
Getting Started Installation, constants, creating your first page
Core Lifecycle, controllers, routing, middleware, views, sessions, redirects
Dual Kernel PHP_SF kernel + Symfony kernel coexistence, bootstrap order
Data & Persistence Entities, repositories, validation, cache, fixtures, enums
Infrastructure Docker, Redis, RabbitMQ, template cache, kernel config
Supporting Features Helper functions, translation, events, CRUD controller
Development & Testing PHPUnit, Codeception, dev mode
Frontend Asset building with Webpack

Requirements

Required:

  • PHP 8.3+ with extensions: apcu, curl, gd, intl, redis, yaml, opcache
  • Composer 2.x
  • Node.js 18+ with yarn
  • Redis (routing cache and application cache)
  • At least one database: PostgreSQL 15+ / MySQL / MariaDB

Optional:

  • ext-amqp + RabbitMQ — only if you use message queues
  • ext-memcached — only if you use Memcached as a cache backend
  • Docker — docker-compose.yml provided for all services
  • Symfony CLI — used by run.sh for HTTPS local dev

Installation

composer create-project nations-original/php-simple-framework-template my-app
cd my-app
./init.sh

init.sh runs once per project — it configures database connections, generates .env and config/constants.php, creates entity/repository directories, and builds frontend assets.

For subsequent machines cloning an already-configured project:

./install.sh

Full setup details: Installation guide.

Project Structure

App/
├── Http/
│   ├── Controller/          # PHP_SF attribute-routed controllers
│   ├── SymfonyControllers/  # Native Symfony controllers (fallback)
│   └── Middleware/          # Custom middleware
├── Entity/                  # Doctrine entities, created by init.sh per connection
├── Repository/              # Entity repositories, created by init.sh per connection
├── DataFixtures/            # Doctrine fixtures (per connection)
├── Enums/                   # Application enums
├── DoctrineLifecycleCallbacks/
└── Kernel.php               # App kernel (extends Symfony Kernel)
config/
├── constants.php            # App-level constants (not committed — copy from .example)
├── packages/                # Symfony bundle config (doctrine, messenger, cache, …)
└── routes.yaml              # Symfony controller route import
templates/                   # PHP view classes (App\View\ namespace)
lang/                        # Translation files
public/                      # Web root

Database Setup

The template ships with only a dummy (default) entity manager that fails fast to prevent accidental cross-DB access. init.sh adds your real connections interactively — you can configure one or more, with any supported engine.

Once configured, the standard Doctrine commands work per-connection using --em=<name>:

bin/console doctrine:database:create --if-not-exists --em=<name>
bin/console doctrine:schema:create --em=<name>
bin/console doctrine:fixtures:load --no-interaction --em=<name>

At minimum you need one connection and one User entity (also generated by init.sh) — the framework requires it for authentication and session handling.

Development

./run.sh              # Start dev server on port 7000 (uses Symfony CLI if available)
bin/console           # Symfony console
npm run dev           # Frontend dev build with watch
npm run build         # Frontend production build
docker-compose up -d  # Start all infrastructure services

Infrastructure services (Docker)

Service Port
PostgreSQL 7003
MySQL 7005
MariaDB 7006
Redis 7002
Memcached 7001
RabbitMQ 7004
Selenium 4444

Full reference: Docker & Local Environment.

Testing

Tests are written with Codeception (Unit, Functional, Acceptance suites).

vendor/bin/codecept run            # Run all suites
vendor/bin/codecept run Functional # Run specific suite

Full reference: Codeception.

License

ISC — see LICENSE.MD.