Package Data | |
---|---|
Maintainer Username: | saritasa |
Maintainer Contact: | sergey@saritasa.com (Sergey Populov) |
Package Create Date: | 2017-03-27 |
Package Last Update: | 2021-03-09 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-04-18 15:23:56 |
Package Statistics | |
---|---|
Total Downloads: | 7,008 |
Monthly Downloads: | 65 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 10 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Custom Blade directives for Laravel Applications.
See https://laravel.com/docs/blade
Install the saritasa/blade-directives
package:
$ composer require saritasa/blade-directives
If you use Laravel 5.4 or less,
or 5.5+ with package discovery disabled,
add the BladeDirectivesServiceProvider service provider config/app.php
:
'providers' => array(
// ...
Saritasa\Laravel\BladeDirectivesServiceProvider::class,
)
Output word 'active' if URL, requested by user, matches provided route name
Example:
<li class="@activeIfRoute('user.settings')">
<a href="{{ route('user.settings') }}">Settings</a>
</li>
Output word 'selected' if passed expression evaluates to true
Example:
<select>
@foreach($users as $user)
<option value='{{ $user->id }}' @selectedIf($user->id == $currentUserId)>{{ $user->name }}</option>
@endforeach
</select>
If you have GNU Make installed, you can use following shortcuts:
make cs
(instead of php vendor/bin/phpcs
) -
run static code analysis with PHP_CodeSniffer
to check code stylemake csfix
(instead of php vendor/bin/phpcbf
) -
fix code style violations with PHP_CodeSniffer
automatically, where possible (ex. PSR-2 code formatting violations)make install
- instead of composer install
make all
or just make
without parameters -
invokes described above install, cs tasks sequentially -
project will be assembled and checked with linter with one single command