Download the PHP package smartisan/laravel-settings without Composer

On this page you can find all versions of the php package smartisan/laravel-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-settings

App & Models Settings for Laravel

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This package allows you to store application wide and model specific Laravel settings. Settings values are type-cast and stored properly. You can also define your own casts and store repository.

Installation

Install the package via composer:

Publish the config file with:

Publish the migration file with:

And finally run the migration with:

Usage

The package provides various APIs to access the settings manager. You can access it with Settings facade, settings() helper method and via HasSettings trait on your models.

Store Settings

You can set single entry, or multiple entries of settings. The values of objects will be cast according to the rules defined in settings.php config file.

You can set multiple settings entries by passing an associative array of keys and values. Casts will be applied on all the payload, even on nested arrays.

It's possible to categorize your settings into groups by calling group method.

It's also possible to set settings for a specific model by calling for method

You can mix all filters together like this:

Retrieve Settings

You can retrieve one or multiple entries and specify the default value if not exist.

If the entry key does not exist, the default value will be placed instead

If you want to retrieve all entries, you simply call all method. You can also specify the model or group. Also to excempt some specific keys.

Note: Remember that retrieving all entries without specifying the group or model, will retrieve all entries that has no group or model set. You can consider these as (global app settings).

Forget Entry

You can remove entries by calling forget method.

Determine Existance

You can determine whether the given settings entry key exists or not

Helper Method

The package also ships with a settings helper method, you can use it instead of using Settings Facade

HasSettings Trait

You can use HasSettings trait on your Eloquent models as well

  1. First prepare your model

  2. Now you can call settings() method on that model. This is equivelant to

Custom Repositories

If you don't want to use the database repository, you can easily create your own settings repository. To do that

  1. Create a class of your repository that implements Repository interface and implement the following methods

  2. In settings configuration file, add your own repository config to repositories attribute

  3. Change the default repository in settings config file to your own repository implementation

Custom Casts

The package allows you to easily create your own casting rules of any object type.

  1. Create your own cast class that implements Castable interface.

Note: The set method is called when the value of the entries is being stored to the repository, and the get method is called when the value is being retrieved from the repository.

  1. Add the casts to the array of casts in settings config file

Note: If you want to pass a parameter to your cast, you can set an object of the cast instead of cast class name

Settings Cache

You can easily enable or disable caching settings in settings.php config file. You can also specify which caching store to use

Testing

To run the package's tests, simply call the following command

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

Alternatives

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-settings with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
illuminate/database Version ^10.0
illuminate/support Version ^10.0
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 smartisan/laravel-settings contains the following files

Loading the files please wait ....