Download the PHP package stilmark/base without Composer
On this page you can find all versions of the php package stilmark/base. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download stilmark/base
More information about stilmark/base
Files in stilmark/base
Download stilmark/base
More information about stilmark/base
Files in stilmark/base
Please rate this library. Is it a good library?
Informations about the package base
Stilmark Base
A lightweight PHP utility library providing essential functionality for modern web applications. Base serves as a foundation for building PHP applications with clean, reusable components.
Features
- Environment Management: Load and access
.envvariables. - Request Handling: A unified interface for HTTP requests, including input retrieval, validation, and sanitization.
- Routing: A simple and fast router with middleware support.
- Controllers: A base controller to extend for application logic.
- Response Rendering: Helpers for sending JSON and CSV responses.
- Session Management: Secure session handling with timeout management and flash data support.
- CSRF Protection: Time-bucketed CSRF tokens with automatic rotation and origin validation.
- Authentication: Multi-provider OAuth2 support (e.g., Google) with session regeneration and timeout management.
- JWT Support: JSON Web Token generation and validation with configurable claims and expiration.
- Logging: PSR-3 compliant file-based logging with JSON format.
- Helper Utilities: Static methods for common tasks like string manipulation.
Requirements
- PHP: version 8.2 or higher
- Composer for dependency management
Dependencies
Base relies on the following libraries (installed via Composer):
- symfony/dotenv – for loading environment variables from
.envfiles - nikic/fast-route – for routing
- league/oauth2-client – for OAuth2 authentication
- league/oauth2-google – Google OAuth2 provider
- firebase/php-jwt – for JWT token generation and validation
Installation
Install via Composer:
Quick Start
1. Basic Setup
Create a bootstrap file (index.php):
2. Environment Configuration
Copy .env.example to .env and configure:
3. Create Your First Controller
Core Components
| Component | Description |
|---|---|
| Env | Loads and manages environment variables from .env. |
| Request | Provides a unified interface for handling HTTP requests, including input retrieval, validation, sanitization, and CSRF token generation/validation. |
| Router | Handles routing, controller/method resolution, and middleware execution. |
| Controller | Base class for application controllers. |
| Render | Provides helper methods for rendering JSON and CSV responses. |
| Session | Secure session management with timeout tracking, flash data, and security configuration. |
| Auth | Handles multi-provider OAuth2 login flows (e.g., Google) with automatic session regeneration. |
| AuthMiddleware | Validates session-based or JWT authentication with idle and absolute timeout management. |
| CsrfMiddleware | Automatic CSRF protection for unsafe HTTP methods with time-bucketed token validation. |
| JWT | JSON Web Token generation and validation. |
| Logger | PSR-3 compliant file-based logger with JSON format. |
| Helper | Provides static utility methods (e.g., string case conversion). |
Usage Examples
Environment Variables
Request Handling
Authentication
Session Management
CSRF Protection
JWT Usage Example
Documentation
Related Projects
- BaseApp - Full application framework built on Base
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Christian Lund
- Email: [email protected]
- Website: stilmark.com
All versions of base with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
symfony/dotenv Version *
nikic/fast-route Version ^1.3
league/oauth2-google Version ^4.0
firebase/php-jwt Version ^7.0
symfony/dotenv Version *
nikic/fast-route Version ^1.3
league/oauth2-google Version ^4.0
firebase/php-jwt Version ^7.0
The package stilmark/base contains the following files
Loading the files please wait ...