Download the PHP package sukohi/quick-dict without Composer

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

QuickDict

A Laravel package for create migration and seeder from key-value data. (This is maintained under Laravel 5.6)

Installation

Execute composer command.

composer require sukohi/quick-dict:1.*

And publish a configuration file.

php artisan vendor:publish --provider="Sukohi\QuickDict\QuickDictServiceProvider"

Now you should have quick-dict.php in /config.

Usage

Please add key-value data in quick-dict.php like so.

return [
    'months' => [
        1 => 'January',
        2 => 'February',
        3 => 'March',
        4 => 'April',
        5 => 'May',
        6 => 'June',
        7 => 'July',
        8 => 'August',
        9 => 'September',
        10 => 'October',
        11 => 'November',
        12 => 'December'
    ]
]

Then run the next command to add the data into DB.

php artisan dict

This means that QuickDict creates migration and seeder then run them.

Add new key-value data

When you'd like to add new key-value data like so, also run php artisan dict. Existing table will be ignored.

return [
    'months' => [
        1 => 'January',
        2 => 'February',
        3 => 'March',
        4 => 'April',
        5 => 'May',
        6 => 'June',
        7 => 'July',
        8 => 'August',
        9 => 'September',
        10 => 'October',
        11 => 'November',
        12 => 'December'
    ],
    'weekday_names' => [    // New
        0 => 'Sunday',
        1 => 'Monday',
        2 => 'Tuesday',
        3 => 'Wednesday',
        4 => 'Thursday',
        5 => 'Friday',
        6 => 'Saturday',
    ]
]

Update key-value data

When you change key-value data of existing table, use php artisan dict:refresh command. The command has two ways.

First one is with table name.

php artisan dict:refresh months

And another one is width --all option.

php artisan dict:refresh --all

Of cause this means all of your key-value data will be replaced with new ones.

Recommendation

After running php artisan dict command, I recommend you to add new Seeder(s) into database/seeds/DatabaseSeeder so that you can manage your key-value data also through seeder commnd like php artisan migrate:fresh --seed.

Retrieve key-value data

You can use dict() helper function for retrieving the key-value data like so.

$collection = dict('months');

// or

echo dict('months.1');  // January

// or

$collection = dict(['months', 'weekday_names']);
echo $collection->toJson();

License

This package is licensed under the MIT License.

Copyright 2018 Sukohi Kuhoh


All versions of quick-dict with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ~5.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 sukohi/quick-dict contains the following files

Loading the files please wait ...