Download the PHP package lukasss93/laravel-model-settings without Composer

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

logo

Laravel Model Settings

version downloads license php

Test Maintainability Test Coverage

Model Settings for your Laravel app

The package requires PHP ^8.0 and follows the FIG standards PSR-1, PSR-2, PSR-4 and PSR-12 to ensure a high level of interoperability between shared PHP.

Bug reports, feature requests, and pull requests can be submitted by following our Contribution Guide.

⚠️ Forked repository

This package is a fork of glorand/laravel-model-settings and contains some breaking changes to make it more flexible and easier to use.

List of changes between this package and the original one:

🚀 Installation

⚙ Publishing the config file

Publishing the config file is optional:

🌈 Update your Eloquent Models

Your models should use the HasSettingsField or HasSettingsTable trait.

Option 1 - HasSettingsField trait

Run the php artisan model-settings:model-settings-field in order to create a migration file for a table.\ This command will create a json field (default name settings, from config) for the mentioned table.\ The default name of the field is settings; change the config or env value MODEL_SETTINGS_FIELD_NAME if you want to rewrite the default name (before you run the command!)

You can choose another than default, in this case you have to specify it in you model.

Complete example:

Option 2 - HasSettingsTable trait

Run before the command php artisan model-settings:model-settings-table.\ The command will copy for you the migration class to create the table where the setting values will be stored.\ The default name of the table is model_settings; change the config or env value MODEL_SETTINGS_TABLE_NAME if you want to rewrite the default name (before you run the command!)

Option 3 - HasSettingsRedis trait

👓 Usage

Check id the settings for the entity is empty

Check settings (exist)

Get all model's settings

Get a specific setting

Add / Update setting

Check if the model has a specific setting

Remove a setting from a model

⬇ Persistence for settings field

In case of field settings the auto-save is configurable.

The default value is true

If the persistence is false you have to save the model after the operation.

🛠️ Using another method name other than settings()

If you prefer to use another name other than settings , you can do so by defining a $invokeSettingsBy property. This forward calls (such as configurations()) to the settings() method.

🌠 Default settings

You can set default configs for a model:

🎉 Initializing settings at model creation

You can initialize settings at model creation by defining a initSettings property in your model:

🔍 Validation system for settings data

When you're using the set(), apply(), update() methods thrown an exception when you break a rule.\ You can define rules on model using settingsRules public method, and the rules array definition is identical with the Laravel default validation rules.

📃 Changelog

Please see CHANGELOG for more information what has changed recently.

📖 License

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


All versions of laravel-model-settings with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-json Version *
illuminate/config Version ^8.0|^9.0|^10.0|^11.0
illuminate/database Version ^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
illuminate/console Version ^8.0|^9.0|^10.0|^11.0
illuminate/filesystem Version ^8.0|^9.0|^10.0|^11.0
illuminate/cache Version ^8.0|^9.0|^10.0|^11.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 lukasss93/laravel-model-settings contains the following files

Loading the files please wait ....