nations-original/php-simple-framework-template
最新稳定版本:v2.2.0
Composer 安装命令:
composer require nations-original/php-simple-framework-template
包简介
README 文档
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 queuesext-memcached— only if you use Memcached as a cache backend- Docker —
docker-compose.ymlprovided for all services - Symfony CLI — used by
run.shfor 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.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: ISC
- 更新时间: 2026-03-29