Is an Extension of Laravel View Class which compiles String Template on the fly. It automatically detects changes on your string template and recompiles it if needed.

Overview

Laravel-fly-view

Is an Extension of Laravel View Class which compiles String Template on the fly. It automatically detects changes on your string template and recompiles it if needed.

This is useful if you want to render your template which came from other sources like CMS or third party API

Since its an Extension of laravel View class. It will not interfere on the usual flow of your application. You can still use laravel view as per normal but with the capability of passing string template.

It supports all directives of Blade Template.

Supports Laravel 5.2+

Installation 🚥

Add the package to your composer.json

"require": {
	...
	"johnturingan/laravel-fly-view": "{version}"
},

Or just run composer require

$ composer require johnturingan/laravel-fly-view

In config/app.php replace

Illuminate\View\ViewServiceProvider::class

with

Snp\FlyView\Providers\ViewServiceProvider::class

Usage

View normal usage:

Pass path to blade file using dot notation on the first parameter

return view('path.to.view', []);
Flyview usage:

Pass array of strings on the first parameter

return view([ 'String Template with {{$blade}} syntax and @directives' ], []);

or you can do

return view([
    '{{ $token }}',
    '{{ $me }}'
], [
    'token' => Str::uuid(),
    'me' => 'Laravel Fly View'
]);

Flyview will merge all strings inside the array before compile. Useful if you have multiple template sources.

You can also use if from response helper like this.

return response()->view([
    '{{ $token }}',
    '{{ $me }}'
], [
    'token' => Str::uuid(),
    'me' => 'Laravel Fly View on Response Helper'
]);

Like I said before, it will not interfere the usual flow of Laravel View. Meaning you can do something like this.

$bag = [
    'include' => [
        '{{ $token }} - This is FlyView Include',
        '@include("includes.nativeInclude") <br/> Above is Include Inception'
    ],
    'data' => [ 'token' => Str::uuid() ]
];

return view('includeTest', $bag);

Inside your includeTest.blade.php file is this:

@include('includes.nativeInclude', $data)

@include($include, $data)

Including string template to blade template file is possible.

Config 📄

All configuration is same as the default view config in your config folder with an additional settings to minimize view contents. Default is false.

/*
    |--------------------------------------------------------------------------
    | Minify View Content
    |--------------------------------------------------------------------------
    |
    | This option determines whether or not you want to minify view contents.
    | It removes unnecessary whitespace
    |
    */
    'minify' => false

NOTE:

If you find any bugs or you have some ideas in mind that would make this better. Please don't hesitate to send comment on github.

If you find this package helpful, a simple star is very much appreciated.


MIT LICENSE
copyright © 2018 Scripts and Pixels.

You might also like...
Automatically load your helpers in your laravel application.

Laravel AutoHelpers Automatically load your helpers in your laravel application. Installation You can install the package via composer: composer requi

A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly.

PHPColors A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly. Requirements PHPColo

A Formatter Class for Laravel 4 based on FuelPHP's Formatter Class

Changelog Update support for Laravel 6 & phpunit 8 Update composer.json Upgrade to PSR-4 add parameter newline, delimiter, enclosure, and escape to ex

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.

Laravel Migrations Generator Generate Laravel Migrations from an existing database, including indexes and foreign keys! This package is cloned from ht

Jetstrap is a lightweight laravel 8 package that focuses on the VIEW side of Jetstream / Breeze package installed in your Laravel application

A Laravel 8 package to easily switch TailwindCSS resources generated by Laravel Jetstream and Breeze to Bootstrap 4.

Dashboard to view your http client requests in laravel application
Dashboard to view your http client requests in laravel application

Laravel Blanket is a package with wraps laravel http client requests and provide logs for request and response, also give option to retry any request from dashboard and more...

View your Laravel routes on the browser.
View your Laravel routes on the browser.

View your Laravel routes on the browser. This package adds a route to your Laravel application. Once you've installed this package, enter /route-list

Filament-spatie-laravel-activitylog - View your activity logs inside of Filament. ⚡️

View your activity logs inside of Filament. This package provides a Filament resource that shows you all of the activity logs created using the spatie

This package provides a Logs page that allows you to view your Laravel log files in a simple UI
This package provides a Logs page that allows you to view your Laravel log files in a simple UI

A simplistics log viewer for your Filament apps. This package provides a Logs page that allows you to view your Laravel log files in a simple UI. Inst

Releases(v1.2.0)
Owner
John Turingan
John Turingan
View themes is a simple package to provide themed view support to Laravel.

Laravel View Themes View themes is a simple package to provide themed view support to Laravel. Installation Add alexwhitman/view-themes to the require

Alex Whitman 15 Nov 29, 2022
Laravel Composable View Composers Package - Compose View Composers from Component Composers

Laravel Virtuoso Laravel Composable View Composers Package Increase flexibility and reduce code duplication by easily composing complex View Composers

Yitzchok Willroth 68 Dec 29, 2021
Package to optimize your site automatically which results in a 35%+ optimization

Laravel Page Speed Simple package to minify HTML output on demand which results in a 35%+ optimization. Laravel Page Speed was created by Renato Marin

Renato Marinho 2.2k Dec 28, 2022
27Laracurl Laravel wrapper package for PHP cURL class that provides OOP interface to cURL. [10/27/2015] View Details

Laracurl Laravel cURL Wrapper for Andreas Lutro's OOP cURL Class Installation To install the package, simply add the following to your Laravel install

zjango 8 Sep 9, 2018
Watch your Laravel app for unwanted changes when working with third-party packages.

Project Secure This package installs a Composer plugin that reports unwanted changes to your Laravel project code after installing or updating a third

The Laravel Hacker 3 Nov 3, 2021
Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology.

Stash View Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology. What is Russian Doll Caching ? It i

Bhushan Gaikwad 18 Nov 20, 2022
🔥 Fire events on attribute changes of your Eloquent model

class Order extends Model { protected $dispatchesEvents = [ 'status:shipped' => OrderShipped::class, 'note:*' => OrderNoteChanged:

Jan-Paul Kleemans 252 Dec 7, 2022
Laravel router extension to easily use Laravel's paginator without the query string

?? THIS PACKAGE HAS BEEN ABANDONED ?? We don't use this package anymore in our own projects and cannot justify the time needed to maintain it anymore.

Spatie 307 Sep 23, 2022
View template engine of PHP extracted from Laravel

Blade 【简体中文】 This is a view templating engine which is extracted from Laravel. It's independent without relying on Laravel's Container or any others.

Scholer 143 Dec 13, 2022
Observe (and react to) attribute changes made on Eloquent models.

Laravel Attribute Observer Requirements PHP: 7.4+ Laravel: 7+ Installation You can install the package via composer: composer require alexstewartja/la

Alex Stewart 55 Jan 4, 2023