Download the PHP package gears/view without Composer
On this page you can find all versions of the php package gears/view. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package view
Short Description Laravel Sessions Standalone
License MIT
Homepage https://github.com/phpgearbox/view
Informations about the package view
Looking for maintainers, I no longer do much if any PHP dev, I have moved on, mostly work in dotnet core, node.js & golang these days. If anyone is keen to take over these projects, get in touch - [email protected]
The Blade View Gear
Laravel Blade Views Standalone
Okay so by now hopefully you have heard of Laravel, the PHP framework that just makes things easy. So first things first full credit goes to Taylor Otwell for the Blade API.
How to Install
Installation via composer is easy:
composer require gears/view:*
How to Use
In your legacy - non Laravel application. You can use the Laravel Blade API like so:
And thats it, now you can use code like the following:
Where the view might look like:
For more info on the View API it's self see: http://laravel.com/docs/responses#views http://laravel.com/docs/templates#blade-templating
View Scope
When you run it checks to see if the class exists globally. If not it use the function to alias it's self in much the same a Laravel Application does.
This enables us to use the API we are familar with.
View Include Path:
You can provide an array of paths, instead of just one path. So in effect you can have a View Include Path. Very handy for setting up a HMVC type system. Here is an example:
So now for the why?
While laravel is so awesomely cool and great. If you want to pull a feature out and use it in another project it can become difficult. Firstly you have to have an innate understanding of the IoC Container.
You then find that this class needs that class which then requires some other config variable that is normally present in the IoC when run inside a normal Laravel App but in your case you haven't defined it and don't really want to define that value because it makes no sense in your lets say legacy application.
Perfect example is when I tried to pull the session API out to use in wordpress. It wanted to know about a method, which I think comes from . At this point in time I already had to add various other things into the IoC to make it happy and it was the last straw that broke the camels back, I chucked a coders tantrum, walked to the fridge, grabbed another Redbull and sat back down with a new approach.
The result is this project.
Developed by Brad Jones - [email protected]