saritasa / php-blade-directives
This package is abandoned and no longer maintained.
The author suggests using the saritasa/blade-directives package instead.
Saritasa custom blade directives
1.0.4
2018-01-17 16:17 UTC
Requires
- php: >=5.5.9
- illuminate/support: 5.*
Requires (Dev)
- phpunit/phpunit: ^6.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2021-03-09 08:02:19 UTC
README
Custom Blade directives for Laravel Applications.
See https://laravel.com/docs/blade
Laravel 5.x
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, )
Available directives
@activeIfRoute(routeName)
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>
@selectedIf(expression)
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>
Contributing
- Create fork, checkout it
- Develop locally as usual. Code must follow PSR-1, PSR-2 - run PHP_CodeSniffer to ensure, that code follows style guides
- Update README.md to describe new or changed functionality
- Add changes description to CHANGES.md file. Use Semantic Versioning convention to determine next version number.
- When ready, create pull request
Make shortcuts
If you have GNU Make installed, you can use following shortcuts:
make cs
(instead ofphp vendor/bin/phpcs
) - run static code analysis with PHP_CodeSniffer to check code stylemake csfix
(instead ofphp vendor/bin/phpcbf
) - fix code style violations with PHP_CodeSniffer automatically, where possible (ex. PSR-2 code formatting violations)make install
- instead ofcomposer install
make all
or justmake
without parameters - invokes described above install, cs tasks sequentially - project will be assembled and checked with linter with one single command