Download the PHP package jshannon63/laravel-baton without Composer

On this page you can find all versions of the php package jshannon63/laravel-baton. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-baton

Baton - Share Laravel named routes and other collection data with javascript

Baton registers a global view composer which will enable passing of the Baton collection to all views. The Baton collection contains all named routes (optional) as well as any additional values you wish to add to the collection prior to rendering the view.

If you are looking for a more flexible package which is specifically designed to pass only named routes to the client I would recommend tightenco/ziggy. It gives many more options for that function. Baton is a good choce when you would like the flexibility of working with collections and quickly/easily passing that data to javascript.

Installation

Laravel 5.5+ will automatically take care of the service provider registration.

Usage

Configuration:

Baton will by default pass named routes to the rendered view. If you wish to disable this action, add the following line to your .env file.

By default, Baton contains a collection of named routes called "routes":

Adding additional data to Baton before passing on to the view

Baton is an extension of the Collection class. You may add, manuipulate or remove any collection elements using the methods of Illuminate\Support\Collection.

Example to add a Blog article to Baton:

First, create a real time Facade for Baton as follows

Then access the put method of Baton using the Facade.

Rendering Baton data in a view

The {!!baton!!} declaration will be replaced with a javascript compliant variable declaration. Notice that the syntax used to embed our $baton variable in the blade view will prevent escaping by the htmlspecialchars() function. You may place {!!$baton!!} anywhere in your view. You may choose to make it available as window.baton or even within a Vue component or other javascript implementation.

This is before rendering...

This is after rendering...

In the above example, the blog route uri is available on the client side as window.baton.routes.blogs

Contributing

If you would like to contribute refer to CONTRIBUTING.md


All versions of laravel-baton with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
laravel/framework Version ^5.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jshannon63/laravel-baton contains the following files

Loading the files please wait ....