Download the PHP package artisan/laravel-settings without Composer

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

Settings Property Bag

Latest Stable Version License

This is a property bag for handling settings objects. This also has integration with Laravel database models out of the box.

Installation

You can install the package via composer:

Usage

A settings bag is a class where you can store your settings that can have fallback values if no explicit values where set. (i.e. persistence)

There are two different ways to get a value from the settings bag.

get($settings, $default = null)

Another is chaining public properties.

To get all the values from the settings bag.

Overriding the default values

Now that we can set values, we want to apply the persisted data to our default settings.

Somtimes, it's a hassle storing array values in the database:

You can instead store your nested settings values via dot notation and this package will destructure the value into a nested array.

Casting

There are times that the values that we pull out the database don't map to the actual data types we want them to be. For that we have a $casts attribute to handle the mapping for all the primitives we need.

The only two properties available right now are: boolean and json.

BUT DON'T FRET! You can either help us out by adding more cast implementations or even make your own from the settings class! (The code is the same).

Adding custom casts

To add custom casts, in your custom settings class (or even a parent class for all your settings classes), create a method prefixed with as.

Laravel Integration

Out of the box, we try to help the setup to a minimal for Laravel projects. After installing via composer, public the config file and migrations.

Run our new settings table migration.

To create the settings file:

And finally, add our settings trait to the model. The trait will automatically look for the settings file in the namespace of your config appended with the word Settings.

So if we have a User.php, by default it will look for the App\Settings\UserSettings class.

To change the class location, you can change the getSettingsClass method in your model.

With that, you can now access your values via the settings public property.

Saving to the database

To save a single value to the database.

To save multiple values at the same time:


All versions of laravel-settings with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^5.7|^6.0
illuminate/database Version ^6.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 artisan/laravel-settings contains the following files

Loading the files please wait ....