Download the PHP package din9xtr/source-context without Composer
On this page you can find all versions of the php package din9xtr/source-context. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download din9xtr/source-context
More information about din9xtr/source-context
Files in din9xtr/source-context
Package source-context
Short Description Package for managing source context and proxy pattern implementation for PHP classes with enum support
License MIT
Homepage https://github.com/din9xtr/source-context
Informations about the package source-context
Source Context Validation Library
A library for validating access to methods based on the source context (API, Web, CLI, etc.) using attributes and dynamic proxies
Features
- Source Validation — Restrict access to methods by source type
- Dynamic Proxies — Automatic generation of proxy classes
- Attributes — Simple declarative configuration via PHP attributes
- Laravel Integration — Ready-to-use Laravel integration
- Multiple Contexts — Support for various context implementations
📦 Installation
🎯 Quick Start
1. Add an attribute to the class
2. Protect methods with the AllowedSources attribute
3. Set the source context
📋 Components
Attributes
-
AutoValidateSources — Marks the class for automatic source validation
- AllowedSources — Restricts access to the method to certain sources
Throws exceptions if the source is not in
#[AllowedSources([])]
Source Contexts
- InMemorySourceContext — In-memory context for request-response applications
- StaticSourceContext — Static context
Enum Source
Supported sources:
Configuration
Laravel Integration
The service provider automatically registers all classes with the AutoValidateSources attribute
Or you can specify them in the source-context.php configuration file
Custom integration
Extension
Adding new sources
License
This project is open-source and available under the MIT License.
Copyright © 2026 Din9xtr