Download the PHP package ws-packages/combination-generate without Composer
On this page you can find all versions of the php package ws-packages/combination-generate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ws-packages/combination-generate
More information about ws-packages/combination-generate
Files in ws-packages/combination-generate
Package combination-generate
Short Description Generate combinations of items in multiple arrays
License MIT
Informations about the package combination-generate
Combination Generate
A Laravel package to generate all possible combinations from multiple arrays. Perfect for creating product variants, configuration options, or any scenario where you need to combine multiple sets of values.
Installation
You can install the package via composer:
For Laravel 5.5+ the service provider will be automatically discovered. For older versions, add the service provider to your config/app.php:
Usage
This package is designed specifically for Laravel applications and integrates seamlessly with Laravel's service container.
Method 1: Dependency Injection (Recommended)
The best way to use this package in Laravel is through dependency injection:
Method 2: Using Laravel's Service Container
Method 3: Using the Helper Binding
Method 4: Using Facade (Simplest)
You can also add the facade alias to your config/app.php for even easier access:
Then use it without the full namespace:
Method 5: In Artisan Commands
Method 6: In Jobs and Queued Tasks
Laravel-Specific Use Cases
E-commerce Product Variants
Form Option Generation
Testing Data Generation
Laravel Integration Features
Service Provider Auto-Discovery
This package supports Laravel's package auto-discovery feature. For Laravel 5.5+, the service provider will be automatically registered.
Available Bindings
The package registers the following bindings in Laravel's service container:
CombinationService::class- Standard class binding'combination-service'- Singleton binding (recommended for performance)'combination'- Facade bindingCombinationfacade - For static method calls
Configuration
No configuration is required! The package works out of the box with Laravel.
Performance Considerations
- The service is registered as a singleton, so it's instantiated only once per request
- For large datasets, consider using Laravel's job queue for processing
- Memory usage scales with the number of combinations generated
API
generateCombination(array $arrays): array
Generates all possible combinations from the provided arrays.
Parameters:
$arrays(array): An array of arrays containing the values to combine
Returns:
array: An array containing all possible combinations
Laravel Example:
Requirements
- PHP ^7.3|^8.0
- Laravel 5.5+
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.