Download the PHP package xgrz/laravel-app-settings without Composer

On this page you can find all versions of the php package xgrz/laravel-app-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-app-settings

Laravel-app-settings

Easy to use and high performance laravel module for handling settings for app. Optimized with 1 hit cache/db each time app is reloaded.

Package handles default settings in config file, so you can simply copy config file to second project with all settings already set.

1. Installation

Install package via composer

Publish configuration

After publishing, you will find 2 config files in your app /config directory.

Set database table name (before next step)

Fill free to update /config/laravel-app-settings-config.php -> database_table in case on conflict with your database schema. Default table name is set to settings.

Run migration

Config and sync settings

Edit your /config/laravel-app-settings-definitions file with your own settings. After all changes are made you have to run sync command in terminal

2. Use settings in code

In this example lets assume, that setting key application.key is already exists.

Preferred way to get your setting value is use global helper function:

setting('application.name');

Function setting($param); accepts as a parameter only setting key.

Second way to get your value is use Settings facade

use xGrz\LaravelAppSettings\Support\Facades\Settings;

Settings::get('application.name`);

This facade method accepts setting key as parameter only.

Missing key behavior

If key doesn't exist

xGrz\LaravelAppSettings\Exceptions\SettingsKeyNotFoundException

will be thrown.

3. Modify settings

If you want to modify only setting value the simplest way is use facade

use xGrz\LaravelAppSettings\Support\Facades\Settings;

Settings::set('application.name`, 'SOME NEW VALUE');

In case of managing settings you may want to change description too.

Out of the box you can use our FormRequest to validate incoming update data in your controller. Validation rules are dynamic and depends on setting type.

In your controller on update method:

4. Add/remove new settings

4.1 Add settings

Go to /config/laravel-app-settings-definitions.php. In this config file you will see tree of defined groups and settings. You are allowed to add new groups and key-names. You can always remove key-name/group from definition file at any time.

After changes are made in definitions file you have to always sync by using artisan command:

php artisan app-settings:sync

Define new settings group Open definitions file and add new array item, for example lets sey we want to add new group named seo:

seo group is empty, so lets add some keys:

Each key should be defined with value, description and type.

type prop expecting to provide SettingValueType (enum xGrz\LaravelAppSettings\Enums\SettingValueType). You can choose from:

value prop is an initial value for key and must be valid for defined type of setting value.

description optional prop. Helpful when you administrate your settings with user interface.

Your config should look like:

Remember to sync settings after editing definitions file

php artisan app-settings:sync

4.2. Remove settings

Delete key name or whole group from definition file and run sync

5. Settings sync after database refresh (seeder).

Everytime you refresh your database you have to run sync (php artisan app-settings:sync) to get back your initial settings. Typically, you want the application to be ready for use after clearing the database, so you can automate this process by adding Seeder.


All versions of laravel-app-settings with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package xgrz/laravel-app-settings contains the following files

Loading the files please wait ....