Download the PHP package fefo-p/laravel-user-preferences without Composer

On this page you can find all versions of the php package fefo-p/laravel-user-preferences. 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-user-preferences

Laravel User Preferences

Forked from RobTrehy/LaravelUserPreferences


This is a package for Laravel that can be used to store and access preferences of the currently authenticated user. The preferences are stored as JSON in a single database column. The default configuration stores this alongside the user record in the users table.

Installation

  1. Run composer require fefo-p/laravel-user-preferences to include this in your project.
  2. Publish the config file with the following command

  3. Modify the published configuration file to your requirements. The file is located at config/user-preferences.php.
  4. Add the preferences column to the database. A migration file is included, just run the following command

    This will add the column defined in your configuration file to the table defined in your configuration file.

Configuration

Open config/user-preferences.php to adjust the packages configuration.

If this file doesn't exist, run php artisan vendor:public --provider="FefoP\LaravelUserPreferences\UserPreferencesServiceProvider" --tag="config" to create the default configuration file.

Set table, column, and primary_key to match your requirements. primary_key should be the users id.

In the defaults array you can set your default values for user preferences.

Example configuration

Usage

Set a preference

Use this method to set a preference for the currently authenticated user

If a default preference value is set in the config file, the new value must match the type of the default value.

If no default value exists, any value type can be saved. If the default value type is not matched UserPreferences::save() will return an InvalidArgumentException.

Reset all default preferences

Use this method to reset the currently authenticated user to the default preferences found in the config file.

Note: This will not adjust user preferences that do not contain a default value in the config file.

Reset a specific default preference

Use this method to reset a single preference, for the currently authenticated user, to the default value found in your config file, if it exists. If no default value is set in the config file, the preference will be removed from the currently authenticated user's record.

This method will return true if a default value was set from the config file. If no default value was found, this method will return false

Get a preference

Use this method to get the value of a preference for the currently authenticated user.

Get all preferences

Use this method to get all of the currently authenticated user's preferences

Check if a user has a specific preference

To check if the currently authenticated user has a specific preference set, you can call

This will return true if a value was found, false if not.

Save a preference

All preferences are saved automatically when UserPreferences::set(); is called.

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

This Laravel package is free software distributed under the terms of the MIT license. See LICENSE

Local testing of this package

Add the following to composer.json


All versions of laravel-user-preferences with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^8.0
doctrine/dbal Version ^3.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 fefo-p/laravel-user-preferences contains the following files

Loading the files please wait ....