Download the PHP package webafra/larasettings without Composer

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

Laravel Setting (WebAfra)

A Laravel 12/13 compatible package to store custom settings in the database and cache, with auto-discovery, publishable migrations & models, and group-based organization.

Requirements

Package version Laravel PHP
^2.0 12, 13 8.2+
^1.0 12 8.1+

Installation

Note: Since this package supports Laravel auto-discovery, you do not need to manually register the ServiceProvider or Facade. If you prefer to register manually, add the following to config/app.php:

Publishing Migrations & Models

Then run the migration:

Usage

Basic get / set

Groups

Settings can be organized into named groups (default group is general):

Primary settings

Primary settings are a special subset (e.g. site-wide configuration) that can be loaded all at once:

Bulk store

Cache management

All values are cached indefinitely via Cache::forever. To invalidate all cached settings:

API Reference

Setting::set()

Stores or updates a setting. Arrays are automatically JSON-encoded. Returns the stored value.

Parameter Type Default Description
$key string — Setting key
$value mixed — Value to store (arrays are JSON-encoded automatically)
$is_primary bool false Mark as a primary setting
$group string 'general' Group namespace

Setting::get()

Retrieves a setting value. Result is cached indefinitely.

Parameter Type Default Description
$key string — Setting key
$default mixed null Fallback value if key does not exist
$group string 'general' Group namespace

Setting::has()

Returns true if the setting exists in the database (does not hit cache).


Setting::delete()

Deletes a setting from the database and clears its cache entry. Returns true on success.


Setting::store()

Stores multiple settings at once. Returns the number of settings saved.


Setting::storePrimary()

Same as store() but marks every entry as primary (is_primary = true). Returns the number of settings saved.


Setting::getPrimary()

Returns all primary settings across all groups as a flat ['key' => 'value'] array. Result is cached indefinitely.


Setting::getGroup()

Returns all settings within a group as a ['key' => 'value'] array. Result is cached indefinitely.


Setting::clean()

Clears the cache for every setting, every group, and the primary collection. Does not delete database records.


Quick reference

Method DB read DB write Cache read Cache write Returns
set() — ✓ — ✓ mixed
get() on miss — ✓ on miss mixed
has() ✓ — — — bool
delete() — ✓ — clears bool
store() — ✓ — ✓ int
storePrimary() — ✓ — ✓ int
getPrimary() on miss — ✓ on miss array
getGroup() on miss — ✓ on miss array
clean() — — — clears all void

Upgrading from v1.x

Version 2.0 introduced a group column and a composite unique key on (group, key). After upgrading the package, publish and run a new migration:

Existing rows will receive the default group value general, so all existing Setting::get() and Setting::set() calls remain fully compatible without any code changes.

License

MIT


All versions of larasettings with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/cache Version ^12.0|^13.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 webafra/larasettings contains the following files

Loading the files please wait ...