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.
- 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
| 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.
Install WebFramework via Composer:
composer require avoutic/web-frameworkOr start with a skeleton project:
composer create-project avoutic/web-framework-skeletonSee the Installation Guide for detailed setup instructions.
<?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.
- 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
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.
Complete documentation is available at web-framework.com.
- 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
- 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
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.
- PHP 8.2 or higher
- Composer
- PSR-7/PSR-15 compatible web server
WebFramework is open-source software licensed under the MIT license.
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.
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.
- 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