wuwx / laravel-plus-view
v9.0.0
2024-05-29 00:36 UTC
Requires
- php: ^7.3|^8.0
- illuminate/support: ^5.6|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^3.6|^4.0|^5.0|^6.0|^7.0|^8.0|^9.0
- phpunit/phpunit: ^7.0|^8.0|^9.0|^10.0|^11.0
README
安装
快速
通过Composer安装,只需运行以下命令
composer require wuwx/laravel-plus-view
添加服务提供者
接下来在 config/app.php
中添加以下服务提供者。
'providers' => [ Wuwx\LaravelPlusView\LaravelPlusViewServiceProvider::class, ],
添加Blade模板
index.html.blade.php
<h1>{{ $dataTypeContent->title }}</h1>
index.json.blade.php
{!! json_encode($dataTypeContent) !!}
测试
curl https://:8000/users curl https://:8000/users?_format=json curl https://:8000/users -H "Accept: application/json"