avoutic / web-framework
A lightweight, secure-by-default PHP microframework built on Slim – providing Laravel-like features (ORM, authentication, migrations, caching) without the bloat. Perfect for building REST APIs and small-to-medium PHP applications.
Installs: 2 366
Dependents: 7
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/avoutic/web-framework
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.9
- latte/latte: ^3.0
- monolog/monolog: ^3.9
- nesbot/carbon: ^3.9
- odan/session: ^6.1
- php-di/php-di: ^7.0
- psr/http-message: ^1.1
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- psr/log: ^3.0
- slim/http: ^1.3
- slim/psr7: ^1.6
- slim/slim: ^4.11
Requires (Dev)
- codeception/codeception: ^5.0
- codeception/module-asserts: ^3.0
- codeception/verify: ^3.0
- haydenpierce/class-finder: ^0.5.3
- phpstan/phpstan: ^2.0
- phpunit/php-code-coverage: ^11.0
- dev-main
- 11.5.0
- 11.4.1
- 11.4.0
- 11.3.1
- 11.3.0
- 11.2.1
- 11.2.0
- 11.1.1
- 11.1.0
- 11.0.6
- 11.0.5
- 11.0.4
- 11.0.3
- 11.0.2
- 11.0.1
- 11.0.0
- 10.2.1
- 10.2.0
- 10.1.0
- 10.0.1
- 10.0.0
- 9.11.0
- 9.10.1
- 9.10.0
- 9.9.1
- 9.9.0
- 9.8.0
- 9.7.0
- 9.6.2
- 9.6.1
- 9.6.0
- 9.5.0
- 9.4.0
- 9.3.1
- 9.3.0
- 9.2.2
- 9.2.1
- 9.2.0
- 9.1.0
- 9.0.0
- 8.5.3
- 8.5.2
- 8.5.1
- 8.5.0
- 8.4.1
- 8.4.0
- 8.3.3
- 8.3.2
- 8.3.1
- 8.3.0
- 8.2.0
- 8.1.1
- 8.1.0
- 8.0.4
- 8.0.3
- 8.0.2
- 8.0.1
- 8.0.0
- 7.11.5
- 7.11.4
- 7.11.3
- 7.11.2
- 7.11.1
- 7.11.0
- 7.10.0
- 7.9.0
- 7.8.2
- 7.8.1
- 7.8.0
- 7.7.0
- 7.6.4
- 7.6.3
- 7.6.2
- 7.6.1
- 7.6.0
- 7.5.5
- 7.5.4
- 7.5.3
- 7.5.2
- 7.5.1
- 7.5.0
- 7.4.3
- 7.4.2
- 7.4.1
- 7.4.0
- 7.3.0
- 7.2.0
- 7.1.0
- 7.0.0
- 6.10.3
- 6.10.2
- 6.10.1
- 6.10.0
- 6.9.0
- 6.8.0
- 6.7.2
- 6.7.1
- 6.7.0
- 6.6.1
- 6.6.0
- 6.5.1
- 6.5.0
- 6.4.0
- 6.3.1
- 6.3.0
- 6.2.1
- 6.2.0
- 6.1.1
- 6.1.0
- 6.0.1
- 6.0.0
- v5.x-dev
- 5.10.1
- 5.10.0
- 5.9.1
- 5.9.0
- 5.8.2
- 5.8.1
- 5.8.0
- 5.7.0
- 5.6.1
- 5.6.0
- 5.5.0
- 5.4.0
- 5.3.3
- 5.3.2
- 5.3.1
- 5.3.0
- 5.2.2
- 5.2.1
- 5.2.0
- 5.1.2
- 5.1.1
- 5.1.0
- 5.0.0
- v4.x-dev
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.1
- 4.0.0
- v3.10.0
- v3.8.0
- v3.7.0
- v3.6.1
- v3.6.0
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.0
- v3.3.7
- v3.3.6
- v3.3.5
- v3.3.4
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.2
- v3.2.1
- v3.2.0
- dev-dependency-injection
- dev-before-objectification-with-fixes
- dev-change-email-fix
This package is auto-updated.
Last update: 2025-12-08 09:24:28 UTC
README
A lightweight, secure-by-default PHP microframework built on Slim – providing Laravel-like features (ORM, authentication, migrations, caching) without the bloat.
WebFramework is a companion framework that extends the Slim Framework with a cohesive set of services for database management, ORM, caching, authentication, middleware, templating, and more. Perfect for developers who love Slim's simplicity but need full-featured components for building modern PHP applications and REST APIs.
Why WebFramework?
- Lightweight PHP Framework: Built on Slim's minimal foundation, WebFramework adds only what you need
- Laravel Alternative: Get Laravel-like features (ORM, migrations, auth) without the heavy footprint
- Slim Framework ORM: Built-in Entity/Repository pattern for database operations
- Slim Framework Authentication: Complete user management flows (registration, login, password reset, email verification)
- Secure-by-Default: Security best practices built into the framework
- PSR-7/PSR-15 Compliant: Modern PHP standards throughout
- Perfect for REST APIs: Ideal for building lightweight PHP APIs and microservices
WebFramework vs Laravel vs Slim
| Feature | Slim | WebFramework | Laravel |
|---|---|---|---|
| Learning Curve | Low | Low | Medium-High |
| Footprint | Minimal | Lightweight | Heavy |
| ORM | ❌ Manual | ✅ Built-in | ✅ Eloquent |
| Migrations | ❌ Manual | ✅ Built-in | ✅ Built-in |
| Authentication | ❌ Manual | ✅ Built-in | ✅ Built-in |
| Caching | ❌ Manual | ✅ Built-in | ✅ Built-in |
| Queueing | ❌ Manual | ✅ Built-in | ✅ Built-in |
| Best For | APIs, Microservices | Small-Medium Apps, APIs | Large Applications |
Use WebFramework if: You want Slim's simplicity with Laravel's convenience, or you're building a small-to-medium application that doesn't need Laravel's full feature set.
Quick Start
Installation
Install WebFramework via Composer:
composer require avoutic/web-framework
Or start with a skeleton project:
composer create-project avoutic/web-framework-skeleton
See the Installation Guide for detailed setup instructions.
Example: Building a REST API
<?php // actions/GetUser.php namespace App\Actions; use WebFramework\Repository\UserRepository; class GetUser { public function __construct( private UserRepository $userRepository, ) {} public function __invoke(Request $request, Response $response, array $routeParams): ResponseInterface { $user = $this->userRepository->find($routeParams['id']); return $response->withJson($user); } }
Check out the example application for a complete working demo.
Features
- Entity/Repository Pattern: Built-in ORM with type-safe entities and repositories
- Database Migrations: Version-controlled schema management
- Authentication & Authorization: Complete user management with email verification
- Input Validation: Type-safe request validation
- Middleware System: PSR-15 compliant middleware pipeline
- Templating: Latte templating engine integration
- Caching: Built-in caching support (Redis module available)
- Queue System: Asynchronous job processing
- Event System: Event-driven architecture
- Dependency Injection: PHP-DI integration
- Multi-language Support: Translation system
- Security: Built-in CSRF protection, secure sessions, and more
Overview
WebFramework applications typically have the following directory structure:
- actions: Contains files for each endpoint and related API functions.
- config: Contains the configuration files for the application.
- migrations: Contains the database migrations for the application.
- definitions: Contains the PHP-DI definitions for the application.
- public: The location for the core
index.phpand external static files like images, CSS, and JavaScript. - scripts: Contains scripts for tasks, migrations, and other automation tasks.
- src: Contains the core application/business logic and model files.
- templates: Contains the templates used by the actions.
- tests: Contains the tests for the application.
- translations: Contains the translation files for the application.
Documentation
Complete documentation is available at web-framework.com.
Key Topics
- Installation Guide: Instructions for installing WebFramework and setting up a base project
- Migration Guide: Guidance on migrating between different versions of WebFramework
- Configuration Management: How to manage and access configuration settings
- Dependency Injection: How to use and configure dependency injection
- Database Usage: How to interact with the database, including queries and transactions
- Database Migrations: How to manage database schema changes
- Entities and Repositories: Understanding the Entity and Repository pattern
- Creating New Entities: Step-by-step guide to creating new entities and repositories
- Input Validation: How to add input validation to your actions
- Routing: How to set up and manage routes
- Middleware Management: How to define and use middleware
- Templating: How to use the Latte templating engine
- Caching: How to use caching to store and retrieve data
- Queueing: How to queue Jobs and handle them asynchronously
- Event Handling: How to trigger and handle Events with EventListeners
Common Use Cases
- Building REST APIs: WebFramework is perfect for creating lightweight PHP APIs with built-in ORM and authentication
- Adding ORM to Slim: If you're using Slim and need database management, WebFramework adds a complete Entity/Repository system
- Laravel Alternative: Need Laravel features without the complexity? WebFramework provides migrations, auth, and more on a Slim foundation
- Microservices: Build small, focused services with WebFramework's minimal footprint
Modules
Extend WebFramework with optional modules for specific needs:
- avoutic/web-framework-mysql: MySQL database module
- avoutic/web-framework-redis: Redis caching and queueing module
- avoutic/web-framework-postmark: Postmark mail module
- avoutic/web-framework-sentry: Sentry.io instrumentation module
- avoutic/web-framework-stripe: Stripe payment integration
- avoutic/web-framework/browserless: Browserless automation module
See the modules documentation for details.
Requirements
- PHP 8.2 or higher
- Composer
- PSR-7/PSR-15 compatible web server
License
WebFramework is open-source software licensed under the MIT license.
Contributing
Contributions are welcome! Whether you're fixing bugs, adding features, or improving documentation, your help makes WebFramework better for everyone.
Before opening an issue or pull request, please read CONTRIBUTING.md.
- Report issues: Found a bug or have a small improvement? Open an issue.
- Design first for larger changes: For larger features or architectural changes, start with a “design” issue so we can discuss the approach before implementation.
- Workflow: Fork the repository, create a feature branch from
main, then open a pull request back tomain. - Improve Documentation: Help make the docs better by submitting improvements
- Share Your Experience: Built something cool with WebFramework? Let us know!
- Code style: Use the existing
php-cs-fixerconfiguration before submitting. - Tests: For new features and bug fixes, add tests where they help prevent regressions and run:
vendor/bin/phpstan vendor/bin/codecept run
By submitting a contribution, you agree that your work is licensed under the MIT License, in line with the project’s license.
This project follows the Contributor Covenant Code of Conduct.
Security
If you discover a security vulnerability, do not open a public issue.
Instead, report it via GitHub Security Advisories so we can coordinate a fix.
For full details, including response timelines and supported versions, see SECURITY.md.
Community & Support
- Documentation: web-framework.com
- GitHub: github.com/avoutic/web-framework
- Example App: github.com/avoutic/web-framework-example
- Packagist: packagist.org/packages/avoutic/web-framework
Made with ❤️ for the PHP community