PHP code example of remarkablemark / rector-laravel-database-expressions
1. Go to this page and download the library: Download remarkablemark/rector-laravel-database-expressions 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/ */
remarkablemark / rector-laravel-database-expressions example snippets
> use Illuminate\Support\Facades\DB;
>
> $expression = DB::raw('select 1');
>
> $string = $expression->getValue(DB::connection()->getQueryGrammar());
>
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Remarkablemark\RectorLaravelDatabaseExpressions\LaravelDatabaseExpressionsRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/app',
__DIR__ . '/bootstrap',
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__ . '/public',
__DIR__ . '/resources',
__DIR__ . '/routes',
__DIR__ . '/storage',
__DIR__ . '/tests',
]);
$rectorConfig->rule(LaravelDatabaseExpressionsRector::class);
};
vendor/bin/rector process --dry-run
vendor/bin/rector process
vendor/bin/rector process --clear-cache
DB::select(DB::raw('select 1'));
DB::select('select 1');