Download the PHP package byteever/container without Composer
On this page you can find all versions of the php package byteever/container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download byteever/container
More information about byteever/container
Files in byteever/container
Package container
Short Description A powerful dependency injection container specifically designed for WordPress plugin development with advanced features like auto-wiring, service binding, and configuration management.
License MIT
Homepage https://github.com/byteever/container
Informations about the package container
ByteEver Container
A powerful dependency injection container specifically designed for WordPress plugin development. This container provides advanced features like auto-wiring, service binding, configuration management, and service tagging to help you build maintainable and testable WordPress plugins.
Features
- 🚀 Dependency Injection: Automatic dependency resolution and injection
- 📦 Service Binding: Bind interfaces to implementations
- 🔧 Configuration Management: Built-in configuration handling with dot notation
- 🏷️ Service Tagging: Group and retrieve related services
- 💡 Auto-wiring: Automatic class instantiation and dependency resolution
- 🎯 Singleton Support: Register shared instances across your application
- 🔄 Alias System: Create shortcuts for your services
- 🎪 WordPress Integration: Designed specifically for WordPress plugin architecture
Installation
Install via Composer:
Or add to your composer.json
:
Quick Start
Basic Usage
WordPress Plugin Integration
Important: For WordPress plugin development, you must pass the main plugin file path to extract plugin metadata.
Configuration Management
The container includes a powerful configuration system with dot notation support:
Service Binding
Basic Binding
Singleton Binding
Instance Registration
Auto-wiring
The container automatically resolves dependencies through constructor injection:
Service Tagging
Group related services with tags:
Aliases
Create convenient shortcuts for your services:
WordPress-Specific Features
Plugin File Integration
Hook Integration
Advanced Usage
Custom Service Providers
Conditional Binding
Method Injection
API Reference
Container Methods
Creation
Container::create(array|string $config = [], string $namespace = __NAMESPACE__): static
Service Resolution
make(string $abstract, array $parameters = []): mixed
get(string $key, mixed $default = null): mixed
Service Binding
bind(string $abstract, Closure|string|null $concrete = null, bool $shared = false): self
singleton(string $abstract, Closure|string|null $concrete = null): self
instance(string|array $abstract, object $instance = null): self
Configuration
get_config(string $key, mixed $default = null): mixed
set_config(string $key, mixed $value): self
has_config(string $key): bool
Service Management
bound(string $abstract): bool
alias(string $abstract, string $alias): void
tag(string $tag, array|string $services): void
tagged(string $tag): array
flush(): void
Best Practices
1. Use Interfaces
2. Register Services Early
3. Use Service Providers for Complex Setup
4. Leverage Auto-wiring
Testing
The container makes testing easier by allowing dependency injection:
Common Patterns
Plugin Architecture
Requirements
- PHP 7.4 or higher
- WordPress 5.0 or higher (for WordPress-specific features)
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Documentation: Full Documentation
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Changelog
See CHANGELOG.md for a list of changes.
ByteEver Container - Powering modern WordPress plugin development with clean, maintainable dependency injection.