toggenation / php-info
将phpinfo()输出嵌入到CakePHP视图中
v0.1.0-alpha
2023-08-05 23:44 UTC
Requires
- php: >=7.2
- cakephp/cakephp: 4.4.*
Requires (Dev)
- phpunit/phpunit: ^8.5 || ^9.3
This package is auto-updated.
Last update: 2024-09-06 05:50:06 UTC
README
使用自定义Helper将phpinfo()的输出嵌入到蛋糕视图。
使用方法
确保加载了PhpInfo插件后
// in a view template <?php /** * @var App\View\AppView $this */ $this->loadHelper('PhpInfo.Info'); $this->Html->css('PhpInfo.styles', ['block' => 'css']); ?> <h1>PHP Info Plugin - Demo</h1> <?= $this->Info->display(); ?>
作为元素
使用此元素,通过一个命令拉取上述所有内容
// pulls in src/templates/element/php-info.php <?= $this->element('PhpInfo.php-info');
VSCode类型提示
需要VSCode安装https://intelephense.com/的bmewburn.vscode-intelephense-client扩展。
// in src/View/AppView.php /** * Application View * * Your application's default view class * @property \PhpInfo\View\Helper\InfoHelper $Info * @link https://book.cakephp.com.cn/4/en/views.html#the-app-view */ class AppView extends View {
在模板中
// add the @var line <?php /** * @var App\View\AppView $this */
安装
该软件包已发布在https://packagist.org.cn/
您可以使用composer将此插件安装到您的CakePHP应用程序中。
安装composer包的推荐方法是
composer require toggenation/php-info:dev-master
如果您将其分支并想使用您自己的分支
您需要将以下repositories属性添加到您的composer.json中,并运行composer update。
或者,只需添加repositories部分,然后运行composer require your-git-hub-user-name/php-info:dev-master
"license": "MIT", "repositories": [ { "type": "vcs", "url": "https://github.com/your-git-hub-user-name/php-info" } ], "require": { "toggenation/php-info": "dev-master" }
测试
目前还没有。待添加