PHP code example of m2collective / laravel-view-directives
1. Go to this page and download the library: Download m2collective/laravel-view-directives 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/ */
m2collective / laravel-view-directives example snippets
use M2Collective\ViewDirectives\Contracts\ClosingDirective;
use M2Collective\ViewDirectives\Contracts\LogicalDirective;
use M2Collective\ViewDirectives\Contracts\OpeningDirective;
final class Example implements OpeningDirective, LogicalDirective, ClosingDirective
{
/**
* @return string
*/
public function openingTag(): string {
return 'openingExample';
}
/**
* @param mixed $expression
* @return string
*/
public function openingHandler(mixed $expression) : string
{
//...
}
/**
* @return string
*/
public function logicalTag(): string {
return 'logicalExample';
}
/**
* @param mixed $expression
* @return string
*/
public function logicalHandler(mixed $expression) : string
{
//...
}
/**
* @return string
*/
public function closingTag(): string {
return 'closingExample';
}
/**
* @param mixed $expression
* @return string
*/
public function closingHandler(mixed $expression) : string
{
//...
}
}
use M2Collective\ViewDirectives\Providers\RegisterDirectives;
final class ExampleServiceProvider extends ServiceProvider
{
use RegisterDirectives;
/**
* @return void
*/
public function boot(): void
{
$this->registerDirective(
new ExampleDirective()
);
// or
$this->registerDirectives([
new ExampleDirective(),
//...
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.