PHP code example of webx-ui / module-tariffs

1. Go to this page and download the library: Download webx-ui/module-tariffs 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/ */

    

webx-ui / module-tariffs example snippets


// config/webx-tariffs.php
'currencies' => ['USD' => '$', 'EUR' => '€', 'UAH' => '₴', 'PLN' => 'zł'],
'variants' => ['primary' => 'Primary', 'secondary' => 'Secondary', 'link' => 'Link'],

[
    'id' => 7,
    'anchor' => 'tariff-7',
    'categories' => [2],               // the ids of its groups
    'name' => 'Combo Starter',
    'badge' => '30 HOURS / 25$',       // '' when there is none
    'price' => 750.0,                  // or null
    'amount' => '750',                 // the number as the page's language writes it; '' without one
    'currency' => 'USD',               // or null
    'symbol' => '$',                   // the code for a currency the config lost; '' without one
    'period' => '/mo',
    'price_text' => '',                // printed when price is null
    'features' => ['Design', 'SEO'],   // the rows written in the language
    'description' => '…',              // '' when it is not written in the language
    'button' => ['label' => 'Get started', 'url' => '/contacts', 'new_tab' => false, 'rel' => null, 'variant' => 'primary'], // or null
    'featured' => true,
    'service_links' => [['id' => 3, 'title' => 'SEO', 'url' => '/seo']], // [] without services
    'fields' => ['note' => '…'],       // the project's own fields, by name
]
bash
composer migrate
php artisan webx:blocks:offered --install --module=tariffs
blade
@foreach ($tariffs['items'] as $tariff)
    <article id="{{ $tariff['anchor'] }}">
        <h3>{{ $tariff['name'] }}</h3>
        @if ($tariff['price'] !== null)
            <p>{{ $tariff['symbol'] }}{{ $tariff['amount'] }} {{ $tariff['period'] }}</p>
        @else
            <p>{{ $tariff['price_text'] }}</p>
        @endif
    </article>
@endforeach