Skip to content

devsimsek/project-sdf

Repository files navigation

Project SDF v2.3.0

Project SDF is a fast, robust, and modern project development framework designed for PHP enthusiasts. It is compact, easy to maintain, and extremely extendable.

version v2.3.0 MIT License PHP 8.2+ 428 tests

Features & Highlights

  • MVC Pattern: Clean separation of concerns.
  • Spark ORM: Built-in QueryBuilder, Active Record, relationships (hasOne, hasMany, belongsTo, belongsToMany), pagination, timestamps, and soft deletes.
  • Middleware Pipeline: PSR-15 inspired request filtering with CSRF, CORS, and Rate Limiting middleware.
  • Authentication: SessionGuard and JwtGuard (HS256) with refresh token support and UserProvider.
  • PSR-7 HTTP Messages: Immutable Request, Response, Uri, Stream, UploadedFile implementations with PSR-4 autoloading.
  • PSR-16 Cache: File, Redis, and Memcached drivers with tag support via a static facade (SDF\Cache\Cache).
  • PSR-3 Logger: LoggerAdapter bridging monolog/mixed loggers to structured SDF\Log\ interface.
  • PSR-14 Events: EventDispatcher with prioritized, stoppable listeners.
  • Schema Builder: MySQL/SQLite Blueprint with foreign keys, timestamps, soft deletes.
  • Localization: Dot-notation translator with pluralization via SDF\Localization\Translator.
  • Mail: SMTP and Log mailers with Mailable fluent API (SDF\Mail\).
  • Queues: Database and Redis queue drivers with Worker (SDF\Queue\).
  • Storage: Local and S3 filesystem abstraction with disk() switching (SDF\Storage\).
  • Encryption: AES-256-CBC with HMAC-SHA256 encrypt-then-MAC (SDF\Encryption\Encrypter).
  • Validation: 19 built-in rules with custom rule support (SDF\Validation\Validator).
  • Fast Routing: Route compilation and caching for O(1) static path matching.
  • Config Loader: Supports .php and .json configs. Compiled to cache automatically.
  • Modern Fuse View Engine: Compiles to raw PHP with Blade-style @extends/@section/@yield/@include inheritance.
  • CLI Commands: Generators for Models, Controllers, Migrations, Tests, Middleware, and more (sdf/cli).
  • Swagger/OpenAPI: Automatic OpenAPI 3.0 spec generation from controller annotations.
  • Composer Ready: PSR-4 autoloading via Composer with APCu optimization.

Tech Stack

PHP: 8.2 or higher is required. The framework is tested up to PHP 8.5.

Performance: ~10,000 req/s on FrankenPHP 1.11 (Mac mini M1, full-stack with Fuse view rendering). See wiki/app/tutorials/docker-frankenphp.md.

Installation

Via Git

git clone https://github.com/devsimsek/project-sdf.git
cd project-sdf
composer install

Via Composer

composer create-project devsimsek/project-sdf

Quick Start

1. Configuration

Copy .env.example to .env and configure your database:

cp .env.example .env

Configure the framework inside app/config/.

2. Run Migrations

php sdf/cli db migrate

3. Generate Code

Use the bundled CLI to generate components:

php sdf/cli g controller UserController
php sdf/cli g model User
php sdf/cli g test UserController --type=controller --namespace=App\\Controllers\\User

4. Run Development Server

php sdf/cli serve -p 8000
# Or with live-reload:
php sdf/cli serve -p 8000 --live

5. Run Tests

vendor/bin/phpunit --testdox

Documentation

Full documentation is available in the wiki/ directory.

Docker

Deploy with Docker Compose (FrankenPHP + MySQL 8.4 + Redis 7):

docker compose up -d

See wiki/app/tutorials/docker-frankenphp.md for detailed setup, worker mode, and performance tuning.

Tests

vendor/bin/phpunit --testdox    # 428 tests, 763 assertions
composer analyze                # PHPStan level 5
composer cs:check               # PHP-CS-Fixer PSR-12

Feedback

If you have any feedback or encounter issues, please open an issue within the repository.

Contributing

Contributions are always welcome! Please follow PSR-12 coding standards and write tests for your components before opening a pull request.

Authors

About

MVC architecture driven php 8 framework

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages