PHP code example of pollora / option

1. Go to this page and download the library: Download pollora/option library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pollora / option example snippets


use Pollora\Option\Option;

// Get with default
$value = Option::get('site_title', 'My Site');

// Smart upsert (creates or updates)
Option::set('site_title', 'New Title');

// Check existence
if (Option::exists('api_key')) {
    Option::delete('api_key');
}

// Update existing
Option::update('posts_per_page', 20);