Download the PHP package cmarfil/laravel-multiuser-json-settings without Composer

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

laravel-multiuser-json-settings

Simple user settings facade for Laravel 4. Settings are stored as JSON in a single database column, so you can easily add it to an existing table (users for example).

Installation

  1. Begin by installing this package through Composer. Edit your project's composer.json file to require cmarfil/laravel-multiuser-json-settings.

  2. Add 'Cmarfil\LaravelMultiUserJsonSettings\ServiceProvider' to providers in app/config/app.php.

  3. Add 'Setting' => 'Cmarfil\LaravelMultiUserJsonSettings\Facade' to aliases in app/config/app.php.

  4. Run php artisan config:publish cmarfil/laravel-multiuser-json-settings to publish the config file.
  5. Modify the published configuration file located at app/config/packages/cmarfil/laravel-multiuser-json-settings/config.php to your liking.
  6. Create a varchar (string) column in a table on your database to match the config file in step 5. Alternatively, use the Laravel migration included in this package to automatically create a settings column in the users table: php artisan migrate --package=cmarfil/laravel-multiuser-json-settings.

Configuration

Pop open app/config/packages/cmarfil/laravel-multiuser-json-settings/config.php to adjust package configuration. If this file doesn't exist, run php artisan config:publish cmarfil/laravel-multiuser-json-settings to create the default configuration file.

Table

Specify the table on your database that you want to use.

Column

Specify the column in the above table that you want to store the settings JSON data in.

Constraint key

Specify the column constraint - this is used to differentiate between different users, objects or models ( normally id ).

Default constraint value

Specify the default constraint value - If you do not specify one, default configuration is obtained, in this case the user logged.

Custom constraint

Specify a where clause for each query - Caution: Leave blank if your want to set or get different rows on same runtime, use constraint_key and default_constraint_value

Usage

Use the Setting facade (Setting::) to access the functions in this package.

Set

Use set to change the value of a setting. If the setting does not exist, it will be created automatically. You can set multiple keys at once by passing an associative (key=>value) array to the first parameter. If you do not pass constraint_value the value used by default is default_constraint_value

Get

Use get to retrieve the value of a setting. The second parameter is optional and can be used to specify a default value if the setting does not exist (the default default value is null). If you do not pass constraint_value the value used by default is default_constraint_value

Forget

Unset or delete a setting by calling forget. If you do not pass constraint_value the value used by default is default_constraint_value

Has

Check for the existence of a setting, returned as a boolean. If you do not pass constraint_value the value used by default is default_constraint_value

All

Retrieve all settings as an associative array (key=>value). If you do not pass constraint_value the value used by default is default_constraint_value

Save

Save all changes back to the database. This will need to be called after making changes; it is not automatic. If you do not pass constraint_value the value used by default is default_constraint_value

Load

Reload settings from the database. This is called automatically if settings have not been loaded before being accessed or mutated. If you do not pass constraint_value the value used by default is default_constraint_value

Example

With default configuration:

The following set and returns the user logged setting "email_notification"

The following set and returns the setting "email_notification" for user with id 23

Finally

Contributing

Feel free to create a fork and submit a pull request if you would like to contribute.

Bug reports

Raise an issue on GitHub if you notice something broken.

Credits

Fork of https://github.com/Grimthorr/laravel-user-settings. Based loosely on https://github.com/anlutro/laravel-settings.


All versions of laravel-multiuser-json-settings with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 4.*
illuminate/config Version 4.*
illuminate/database Version 4.*
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 cmarfil/laravel-multiuser-json-settings contains the following files

Loading the files please wait ....