• Stars
    star
    722
  • Rank 62,738 (Top 2 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Global key-value store in the database

Laravel Options

Latest Version on Packagist Total Downloads Software License Build Status

Global key-value store in the database

Installation

To get started with laravel-options, use Composer to add the package to your project's dependencies:

composer require appstract/laravel-options

Publish, migrate

By running php artisan vendor:publish --provider="Appstract\Options\OptionsServiceProvider" in your project all files for this package will be published. For this package, it's only a migration. Run php artisan migrate to migrate the table. There will now be an options table in your database.

Usage

With the option() helper, we can get and set options:

// Get option
option('someKey');

// Get option, with a default fallback value if the key doesn't exist
option('someKey', 'Some default value if the key is not found');

// Set option
option(['someKey' => 'someValue']);

// Remove option
option()->remove('someKey');

// Check the option exists
option_exists('someKey');

If you want to check if an option exists, you can use the facade:

use Option;

$check = Option::exists('someKey');

The helpers are available as Blade directives:

@option('someKey')

@option('someKey', 'Default value')

@optionExists('someKey')
    // Code
@endif

Console

It is also possible to set options within the console:

php artisan option:set {someKey} {someValue}

Testing

$ composer test

Contributing

Contributions are welcome, thanks to y'all :)

About Appstract

Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon.

License

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

More Repositories

1

laravel-opcache

Laravel Package for OPcache
PHP
1,327
star
2

laravel-blade-directives

A collection of nice Laravel Blade directives
PHP
858
star
3

laravel-stock

Keep stock for Eloquent models
PHP
287
star
4

laravel-multisite

Multiple sites on one codebase
PHP
216
star
5

laravel-bootstrap-components

Bootstrap components as Laravel components
HTML
192
star
6

laravel-meta

Metadata for Eloquent model
PHP
129
star
7

laravel-tracer

Shows the path of each blade file loaded in a template
PHP
98
star
8

nova-horizon

Horizon statistics in Nova
Vue
79
star
9

lush-http

Smart Http Client for PHP
PHP
63
star
10

dd.js

Laravel dd() in JS
JavaScript
53
star
11

laravel-elixir-env

Use .env variables in Javascript with Laravel Elixir
JavaScript
39
star
12

laravel-response-macros

Extra response macro's for Laravel
PHP
33
star
13

laravel-referer-redirector

Manage redirects based on referers
PHP
32
star
14

nova-opcache

OPcache Tool for Laravel Nova
Vue
19
star
15

php-hostsfile

Read & Write HostsFile Entries with PHP
PHP
13
star
16

laravel-artisan-scan

[WIP] Scan for multiple improvement points
PHP
11
star
17

laravel-crawl-render

Pre-render Javascript sites for web crawlers
PHP
11
star
18

laravel-dusk-safari

Run Dusk tests in Safari
PHP
11
star
19

skeleton-php

Skeleton for PHP packages
PHP
11
star
20

vue-validate

[DEPRECATED] Input validation for Vue
JavaScript
10
star
21

laravel-moneybird

Laravel package for Moneybird
PHP
9
star
22

laravel-dusk-opera

Run Dusk tests in Opera
PHP
8
star
23

nova-signature-field

Signature Pad as a Nova Field
Vue
7
star
24

pakketpartner-php-client

PHP Client for the Pakketpartner API
PHP
7
star
25

laravel-pakketpartner

Wrapper for the Pakketpartner PHP Client
PHP
4
star
26

laravel-bol-retailer

Wrapper package for Bol.com Retailer API
PHP
2
star
27

laravel-twikey

PHP
2
star