Download the PHP package toneflix-code/laravel-dbconfig without Composer

On this page you can find all versions of the php package toneflix-code/laravel-dbconfig. 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-dbconfig

Laravel DbConfig (Database Configuration)

Test & Lint Latest Stable Version Total Downloads License PHP Version Require codecov

A Laravel package that allows you to configure your app using database entries with support for Arrays and files.

Features

Installation

You can install the package via composer:

Package Discovery

Laravel automatically discovers and publishes service providers but optionally after you have installed Laravel Fileable, open your Laravel config file if you use Laravel below 11, config/app.php and add the following lines.

In the $providers array add the service providers for this package.

If you use Laravel >= 11, open your bootstrap/providers.php and the above line to the array.

Asset Publishing

To customize migrations, publish the migration files with:

To customize configuration options, publish the config file with:

Custom Tables

If you need to customize the names of the tables used, edit the table property of the laravel-dbconfig configuration file, setting the table names according to your requirement.

Migration

Once you're doing with initial setup, run php artisan migrate to migrate your database, when you have done this, then the library is ready for use.

Usage

Creating Configuration Options

Artisan Command

To create configuration options from the CLI you can use the dbconfig:create Artisan command

Database seeding

If you have multple options and do not want to add them one after the other, you can publish the factory and seeder then modify the seeder, adding in all the option you require in the array and seeding your database as usual.

  1. Publish factory and seeder by running php artisan vendor:publish --tag dbconfig-data.
  2. Modify seeder.
  3. Seed your database by running php artisan db:seed ConfigurationSeeder.

Accessing configuration

To access your saved configuration, you can call the config helper method on the Configure class.

Or use the flat helper function.

Accessing all configuration option

If you do not provide a key when calling Configure::config() or dbconfig() an instance of Illuminate\Support\Collection will be returned with all available configuration options as [key => value] pair collection.

Or

Updating Configurations

Passing an array to the dbconfig function or the config method will imply that you want to update the configuration option.

Or

In either case, the calls will return an instance of \Illuminate\Support\Collection with the current state of the config.

Supported Data types

When creating configuration options, you will be required to provide a value for the type attribute, which is used to determine what kind of data to expect from the config value.

This library supports the following data types as values:

  1. string
  2. bool
  3. int
  4. float
  5. json
  6. file

For convinience and in order to provide flexibility, we will also map the following type config values to their applicable data types:

  1. [textarea, text]: string
  2. [number, integer]: int
  3. [boolean]: bool
  4. [file]: array of file
  5. The json data type will automatically be wrapped with an \Illuminate\Support\Collection instance.

Secret Data

When creating your options, if you set the secret attribute to true, the value will automatically be masked whenever it is accessed.

To allow secret values to be visible, when you call the Configure::config() or dbconfig() methods, set the loadSecret argument to true, this will ensure that, even secret values are visible.

Or

Files

Configuration options of type file will be uploaded to your configured storage driver and a direct link to the file will be generated and passed as the configuration value.

Whe the configuration type is files, the files will be uploaded and you will get an \Illuminate\Support\Collection of direct link urls to all the uploaded files.

Storage path

The library uses toneflix-code/laravel-fileable for storing files, you can configure the upload path and othe options by modifying the upload_collection property of the laravel-dbconfig configuration file or add a dbconfig collection to the toneflix-fileable configuration.

Saving configuration with file values

To save a configuration with a file value, simply pass an instance of Illuminate\Http\UploadedFile as a value when setting the configuration, the lirary takes care of the rest.

Or

Artisan Commands

The library ships with 4 artisan commands provided to to make working with the library a little bit less straining, maybe, but let's get to it.

dbconfig:create

The dbconfig:create command allows you to create new configuration options, to use, run it like in the examples below.

You will be presented with interactive questions to help you create your config option, alternatively, you can also pass the option definition directly to the command to create without prompts:

When you run the dbconfig:create passing all options directly, you will still be required to confirm, where you do not want to to be required to confirm, you can pass the --force option, which will run the command without prompts.

dbconfig:purge

The dbconfig:purge command allows you to purge or remove configuration options from the database.

Running the command without arguments will cause the entire configuration table to be truncated but if you wish to only remove a particular key from the table, simply pass the key argument.

dbconfig:set

The dbconfig:set command allows you to set or update the value of a configuration option.

You will be presented with interactive questions to help you update the value of your config option, alternatively, you can also pass the key and value arguments directly to the command to update without the prompts:

dbconfig:show

The dbconfig:show command will display all of the values for the database configurations.

Additional

You may also run the php artisan about command to see usefull information about your confiuration state.

And that's it folks, happy coding...

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

TODO

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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


All versions of laravel-dbconfig with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
illuminate/support Version ^9.0|^10.0|^11.0
toneflix-code/laravel-fileable Version ^2.1.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 toneflix-code/laravel-dbconfig contains the following files

Loading the files please wait ....