Package Data | |
---|---|
Maintainer Username: | gregoriohc |
Maintainer Contact: | gregoriohc@gmail.com (Gregorio Hernández Caso) |
Package Create Date: | 2016-08-25 |
Package Last Update: | 2016-09-03 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-19 03:15:38 |
Package Statistics | |
---|---|
Total Downloads: | 196 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 2 |
Total Forks: | 2 |
Total Open Issues: | 0 |
WARNING: USE THIS PACKAGE ONLY IN LOCAL/DEBUG MODE! ENABLING THIS PACKAGE IN PRODUCTION ENVIRONMENTS CAN REPRESENT A BIG SECURITY ISSUE!
View preview package for Laravel
This package can be used to preview your laravel views without needing to create a route or controller to load the view. It can also be useful if you want to preview your emails views without needing to send them.
You can install the package via composer:
composer require gregoriohc/laravel-preview
You must install the service provider:
// config/app.php
'providers' => [
...
Gregoriohc\Preview\PreviewServiceProvider::class,
],
Now, if you are in local environment with debug mode enabled, you can access the preview route.
The preview route path has the following structure: /_preview/{view}?{params}
The {view}
can be any app or package view, using the dot and namespace notation of Laravel (ex.: welcome, errors.503, mypackage::myview)
For example, if you want to preview the Laravel default welcome page, you can go to: /_preview/welcome
The optional {params}
can be a list of parameters that will be converted to variables and passed to the view. The key of the parameter will be the variable name, and the value will be transformed depending on its format. The possible formats are the following:
user={"name": "John Doe", "email": "johndoe@example.com"}
::
) the model class (with full namespace) and the object ID you are looking for. For example: user=App\User::1
.::
) the class (with full namespace), the method, and a list of params. For example: appname=Config::get::app.name
or something=MyClass::myMethod::param_1::param_2::param_3
. If the method is static, it will called statically, if not, a class object will be instantiated and the method will be called.More examples:
/_preview/emails.user.welcome?user=App\User::1
/_preview/admin.user.show?user=App\User::1
/_preview/mypackage::my.fantastic.view?something=Cache::get::something&anotherthing=textcontent&somenumber=123
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email gregoriohc@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.