Download the PHP package danjamesmills/config-class-resolver without Composer
On this page you can find all versions of the php package danjamesmills/config-class-resolver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danjamesmills/config-class-resolver
More information about danjamesmills/config-class-resolver
Files in danjamesmills/config-class-resolver
Package config-class-resolver
Short Description A Laravel package for resolving classes based on configuration
License MIT
Homepage https://github.com/danjamesmills/config-class-resolver
Informations about the package config-class-resolver
Laravel Config Class Resolver
A simple Laravel package for resolving classes based on configuration.
Installation
Install the package via Composer:
Usage
To resolve a class from the configuration, call the resolve_class_from_config function with the appropriate parameters:
resolve_class_from_config('your-package-name', 'class');
In the example above, 'your-package-name' represents the main configuration key, and 'class' represents the specific key within that configuration.
If the configuration exists and the class is found, the function will return the resolved class instance. If the class is not found, it will throw a ClassNotFoundException.
Example
Ensure that your configuration file ('config/calls.php') contains the necessary entries for the classes you want to resolve. Here's an example configuration file:
In this example, 'your-package-name' represents the main configuration key. Make sure to replace '\App\Models\YourModel::class' with the appropriate class you want to resolve.
License
This package is open-source software licensed under the MIT license.