Download the PHP package escolalms/settings without Composer
On this page you can find all versions of the php package escolalms/settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download escolalms/settings
More information about escolalms/settings
Files in escolalms/settings
Package settings
Short Description Escola LMS Settings and custom fields management
License MIT
Informations about the package settings
Settings
Configuration management package
Purpose
This package can be used to register application config keys which can be then modified through API and/or Admin Panel.
Installation
composer require escolalms/settings
php artisan migrate
php artisan db:seed --class="EscolaLms\Settings\Database\Seeders\PermissionTableSeeder"
- optional:
php artisan vendor:publish --tag=escola_settings.config
to publish config file
Dependencies
Usage
Configuration
Config file contains use_database
option, which determines if Config should be written and loaded to database (if true
), or config files should be overwritten (if false
);
Registering config keys
Every package can register config keys by calling registerConfig
static method from AdministrableConfig
Facade in its own Package Service Provider register
method.
When registering a configuration key you can:
- specify validation rules for values that can be stored (using any of rules available for Laravel validator)
- specify if key is
public
(so anonymous users can retrieve the value) - specify if key is
readonly
(so it is returned by API but can not be changed using API)
Loading config
Config will be automatically loaded from database (if use_database
config options is true). Otherwise, if overwriting config files is chosen, normal Laravel config loading mechanism is used.
Changing config
EscolaLms\Settings\Facades\AdministrableConfig
facade can also be used to modify and retrieve values for registered config keys.
These methods are utilised by web API of this package.
Config Repository Extension & Config Rewriter
This package extends basic config
Facade of Laravel Framework wrapping it in EscolaLms\Settings\ConfigRewriter\ConfigRepositoryExtension
decorator. This extended Config repository has a write
method that can be called to store all in-memory changes to configuration values straight into config files. Writing operation tries to preserve structure of original config files (order of keys, comments, etc.) but it's not always possible (parses this package uses is WIP) and sometimes everything other than keys and values can be removed from config file. Using Database to store modified config values is a safer (non-destructive) option.
Endpoints
All the endpoints are defined in .
Events
EscolaLms\Settings\Events\SettingPackageConfigUpdated
emitted when settings are changed using web API.
Listeners
No Listeners are defined in this package.
How to use this package on Frontend
Admin Panel
Left menu
List of registered Settings for single package (EscolaLms\Auth package used in screenshot)
Editing registered Setting
Tests
Run ./vendor/bin/phpunit --filter 'EscolaLms\\Settings\\Tests'
to run tests. See tests folder as it's quite good staring point as documentation appendix.
Permissions
Permissions are defined in Seeder.
Roadmap. Todo. Troubleshooting
- Describe what "Settings" part of this package does (as only "Config" was described, and this package has/had second purpose)