Download the PHP package jbtronics/settings-bundle without Composer

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

Documentation

codecov

Settings bundle

Settings-bundle is a symfony bundle that let you easily create and manage user-configurable settings, which are changeable via a web frontend. It allows for easy creation of type-safe settings objects, which can be easily managed and changed via a web frontend in your symfony application.

Introduction

By default, symfony is mostly configured by parameters in configuration files, where a recompilation of the container is required, or via environment variables, which can not be easily changed by the application itself.

However, you often want administrators and users of your application let change settings and configuration of your application. This bundle provides a simple way to do this. Unlike other bundles with a similar goal, this bundle tries to be as modular as possible and to be as type-safe as possible. Therefore you define your Settings as a class, and access objects of this class in your application, instead of doing simple key-value lookups with mixed return types.

All relevant definitions of settings are done directly in the settings class via metadata attributes. This makes it easy to understand and maintain the settings. The bundle also provides a simple way to generate forms to change the settings, which can be easily integrated into your application.

Features

Requirements

Installation

Add the bundle to your symfony project via composer:

If you are using symfony flex, the bundle should be automatically enabled. Otherwise you have to add the bundle to your config/bundles.php file:

Usage

The following section is just a quick overview. See documentation for full info.

Settings classes are simple PHP classes, which are annotated with the #[Settings] attribute. They must live in the path configured to store settings classes (normally src/Settings), in your symfony project. The bundle will automatically find and register all settings classes in this directory.

The properties of the classes are used for storing the different data. Similar to the #[ORM\Column] attribute of doctrine, you can use the #[SettingsParameter] attribute to make a class property to a managed parameter. The properties can be public, protected or private (as SettingsBundle accesses them via reflection), but you have some kind of possibility to access the properties to get/set the configuration parameters in your software. You have to configure, which type mapper should be used to map the normalized data from the storage backend to the type of property. The bundle comes with a few default type mappers, but you can also implement your own type mappers.

The main way to work with settings is to use the SettingsManagerInterface service. It offers a get() method, which allows to retrieve the current settings for a given settings class. If not loaded yet, the manager will load the desired settings from the storage backend (or initialize a fresh instance with default values). The instances are cached, so that the manager will always return the same instance for a given settings class. The manager also offers a save() method, which allows to save the current settings to the storage backend and persist the changes.

Alternatively if you have a service, which depends on the settings, you can inject the current settings instance directly via dependency injection. The bundle registers a service for each settings class, which can be injected into your services like any other service. Internally the settings manager get() method is called to retrieve a lazy loaded settings instance:

The instance injected via dependency injection is the same as the one you would get via the settings manager. This means, that all changes to the settings instance are updated automatically in all parts of your application.

Forms

The bundle can automatically generate forms to change settings classes. This is done via the SettingsFormFactoryInterface, which creates a form builder containing fields to edit one or more settings classes. You can also render just a subset of the settings. Validation attributes are checked and mapped to form errors. This way you can easily create a controller, to let users change the settings:

Form rendering can be customized via the Parameter attributes. See documentation for full info.

Twig templates

In twig templates you can access the settings via the settings_instance() function, which behaves like the SettingsManagerInterface::get() function and returns the current settings instance:

License

SettingsBundle is licensed under the MIT License. This mostly means that you can use this bundle for whatever you want (even use it commercially) as long as you retain the copyright/license information.

See LICENSE for more information.


All versions of settings-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
symfony/framework-bundle Version ^6.4|^7.0
symfony/translation-contracts Version ^2.5|^3.0
symfony/validator Version ^6.4|^7.0
symfony/form Version ^6.4|^7.0
symfony/var-exporter Version ^6.4|^7.0
ergebnis/classy Version ^1.6
symfony/translation Version ^7.0|^6.4
symfony/deprecation-contracts Version ^3.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 jbtronics/settings-bundle contains the following files

Loading the files please wait ....