nhzex / think-blade
Use Laravel Blade templates without the full Laravel framework
Installs: 2 387
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ^8.0
- ext-fileinfo: *
- ext-json: *
- ext-mbstring: *
- psr/container: ^1.1.1|^2.0.1
- psr/simple-cache: ^1.0|^2.0|^3.0
- symfony/finder: ^6.0
- topthink/framework: ^6.1|^8.0
- topthink/think-helper: ^3.1.6
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8
- php-cs-fixer/shim: ^3.22
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9
- rector/rector: ^0.17.12
- symfony/mime: ^6.0
- topthink/think-template: ^2.0
Suggests
- doctrine/inflector: Required to use the pluralizer (^2.0).
- nesbot/carbon: nesbot/carbon=^2.62.1
- ramsey/uuid: Required to use Str::uuid() (^3.7).
- symfony/mime: Required to enable support for guessing extensions (^6.0).
- symfony/var-dumper: Required to use the dd function (^6.0).
- voku/portable-ascii: Required to enable support for string ascii extensions (^2.0).
Replaces
- illuminate/collections: ~9.52.15
- illuminate/container: ~9.52.15
- illuminate/contracts: ~9.52.15
- illuminate/support: ~9.52.15
- illuminate/view: ~9.52.15
This package is auto-updated.
Last update: 2024-12-17 09:14:12 UTC
README
thinkphp 6.1, 8.0 blade 视图渲染驱动
blade版本: v9.52.15
Installation
composer require nhzex/think-blade
view.php
<?php [ // 模板引擎类型 'type' => 'blade', // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 'auto_rule' => 1, // 模板目录名 'view_dir_name'=> 'view', // 模板后缀 'view_suffix' => 'blade.php', // 模板文件名分隔符 'view_depr' => DIRECTORY_SEPARATOR, // 编译缓存 'tpl_cache' => true, ];
统一扩展注册(7.x 暂不支持)
<?php $register = app()->make(\HZEX\Blade\Register::class); $register->directive('strlen', function ($parameter) { return "<?php echo strlen($parameter) ?>"; }); $register->if('auth', function ($parameter) { return true; });
auth 支持 (自行实现并绑定到以下命名)
- app->bind('auth', concrete::class)
- auth->check(): bool
- auth->guest(): bool
- app->bind('auth.gate', concrete::class)
- auth->check($abilities, $arguments): bool
- auth->denies($abilities, $arguments): bool
- auth->any($abilities, $arguments): bool