PHP code example of sebdesign / blade-sql-formatter

1. Go to this page and download the library: Download sebdesign/blade-sql-formatter 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/ */

    

sebdesign / blade-sql-formatter example snippets




use Doctrine\SqlFormatter\HtmlHighlighter;

return [
    'highlighter' => HtmlHighlighter::class,

    'html_attributes' => [
        HtmlHighlighter::HIGHLIGHT_QUOTE => 'style="color: blue;"',
        HtmlHighlighter::HIGHLIGHT_BACKTICK_QUOTE => 'style="color: purple;"',
        HtmlHighlighter::HIGHLIGHT_RESERVED => 'style="font-weight:bold;"',
        HtmlHighlighter::HIGHLIGHT_BOUNDARY => '',
        HtmlHighlighter::HIGHLIGHT_NUMBER => 'style="color: green;"',
        HtmlHighlighter::HIGHLIGHT_WORD => 'style="color: #333;"',
        HtmlHighlighter::HIGHLIGHT_ERROR => 'style="background-color: red;"',
        HtmlHighlighter::HIGHLIGHT_COMMENT => 'style="color: #aaa;"',
        HtmlHighlighter::HIGHLIGHT_VARIABLE => 'style="color: orange;"',
        HtmlHighlighter::HIGHLIGHT_PRE => 'style="color: black; background-color: white;"',
    ],

    'use_pre' => true,

    'indent_string' => '  ',
];

return [
    'paths' => [
        resource_path('views'),
        database_path('queries'),
    ],
];

public function boot()
{
    $this->loadViewsFrom(database_path('queries'), 'sql');
}

public function show()
{
    return view('sql::users.select-first-user');
}

@
bash
php artisan vendor:publish --tag="blade-sql-formatter-config"