Download the PHP package rawnoq/laravel-settings without Composer

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

Laravel Settings

Latest Version Total Downloads License

A powerful and flexible Laravel package for managing application settings with full translatable support. This package provides an elegant solution for storing and retrieving settings with support for multiple languages, groups, and various data types.

Features

Requirements

Installation

You can install the package via Composer:

The package will automatically register its service provider and facade.

Configuration

Publish the configuration file:

This will create a config/settings.php file where you can define default settings.

Database Setup

Publish and run the migrations:

This will create the settings and setting_translations tables.

Quick Start

Using Helper Functions

The package provides convenient global helper functions:

Setting Values

Getting Values

Usage Guide

Value Types

Fixed Values

Fixed values are stored directly and are not translatable:

Translatable Values

Translatable values are stored per locale and automatically detected when you pass an array with locale keys:

The package supports any locale code. When you pass an array with string keys, it will automatically be detected as a translatable value. Common locale codes include: ar, en, fr, es, de, it, pt, ru, zh, ja, ko, and any other locale code you need.

Groups

Organize your settings into logical groups:

Loading from Configuration

You can preload settings from your configuration file:

Seeding Example

You can seed your settings database using Laravel seeders and the settings()->seed() helper.

Create a seeder class (e.g. database/seeders/SettingsSeeder.php):

Register it in your application seeder (database/seeders/DatabaseSeeder.php):

Run the seeder:

If you are working inside a module (e.g. using HMVC), the same approach appliesโ€”just adjust the namespaces and registration according to your module structure.

Advanced Usage

Using the Service Directly

Using the Repository

Query Builder Integration

The package integrates with Spatie Query Builder for advanced querying:

API Responses

You can create your own API Resources or return settings directly:

Working with Models

You can also work directly with the Eloquent models:

Helper Functions

setting($key = null, $value = null, $group = null, $onlyAddGroup = false)

A global helper function for getting or setting values.

Setting a value:

Getting a value:

settings(?array $keyToValue = null)

A global helper function for bulk operations or getting all settings.

Set multiple settings:

Get all settings:

API Reference

Facade Methods

set(string $key, string|array $value, string|array|null $group = null, bool $onlyAddGroup = false): void

Set a setting value.

setMany(array $keyToValue): void

Set multiple settings at once.

get(string|array $key): Collection|Setting

Get setting(s) by key(s). Returns a single Setting model or a Collection.

all(): LengthAwarePaginator|Paginator|Collection

Get all settings.

getByGroup(string $group): Collection

Get all settings in a specific group.

getByGroupAsKeyValue(string $group): array

Get settings in a group as a key-value array.

load(?array $settings = []): void

Load settings from a configuration array.

Database Schema

Settings Table

Setting Translations Table

Best Practices

  1. Use Groups: Organize related settings into groups for better management
  2. Naming Convention: Use descriptive, dot-notation keys (e.g., site.general.name)
  3. Translatable Content: Use translatable values for user-facing content
  4. Fixed Values: Use fixed values for system configuration
  5. Cache Settings: Consider caching frequently accessed settings
  6. Validation: Validate setting values before storing

Troubleshooting

Settings not persisting

Make sure migrations have been run:

Translations not working

Ensure astrotomic/laravel-translatable is properly configured and the setting_translations table exists.

Group filtering not working

Groups are stored as comma-separated values. The package handles partial matches automatically.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

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

Support

For support, please open an issue on the GitHub repository.

Changelog

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


All versions of laravel-settings with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.0
illuminate/database Version ^12.0
illuminate/http Version ^12.0
spatie/laravel-query-builder Version ^6.0
astrotomic/laravel-translatable Version ^11.16
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 rawnoq/laravel-settings contains the following files

Loading the files please wait ...