PHP code example of dyanakiev / litwig2020

1. Go to this page and download the library: Download dyanakiev/litwig2020 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/ */

    

dyanakiev / litwig2020 example snippets


\DinhQuocHan\Twig\TwigServiceProvider::class,

'Twig' => \DinhQuocHan\Twig\Facades\Twig::class,

// Normal (template.html.twig or template.css.twig or template.twig)
return view('template', ['some_variable' => 'some_values']);

// With vender namespace
return view('vendor_namespace::template', $data);



namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use DinhQuocHan\Twig\Facades\Twig;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Twig::addFilter(new TwigFilter('money_format', function ($price) {
            return sprintf('%d %s', number_format($price), 'US$');
        }));
    }
}

php artisan vendor:publish --provider="DinhQuocHan\Twig\TwigServiceProvider"