Download the PHP package macellan/laravel-js-routes without Composer

On this page you can find all versions of the php package macellan/laravel-js-routes. 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-js-routes

Laravel Javascript Routes

Why

I love the Laravel routing system and I often use named routes like route('users.show', array('id' => 1)) to generate http://domain.tld/users/1. With the amazing uprising of Javascript frameworks (AngularJS, EmberJS, Backbone, etc.) it's hard to track changes on your routes between the backend and the REST calls from your Javascript. The goal of this library is to expose those named routes to your frontend so you can do: Router.route('users.show', {id: 1}) and get the same result.

Installation

You can install this package via composer:

Usage

By default the command will generate a routes.js file on your project root. This contains all named routes in your app. That's it! You're all set to go. Run the artisan command from the Terminal to see the new routes:javascript commands.

Lazy Tip If you use Grunt, you could set up a watcher that runs this command whenever your routes files change.

Arguments

Name Default Description
name routes.js Output filename

Options

Name Default Description
path base_path() Where to save the generated filename. (ie. public assets folder)
object Router If you want to choose your own global JS object (to avoid collision)
prefix null If you want to a path to prefix to all your routes

Javascript usage

You have to include the generated file in your views (or your assets build process).

And then you have a Routes object on your global scope. You can use it as:

Example:

If you assign parameters that are not present on the URI, they will get appended as a query string:

Contributing

In addition to a full test suite, there is Travis integration.

Found a bug?

Please, let me know! Send a pull request or a patch. Questions? Ask! I will respond to all filed issues.

Inspiration

Although no code was copied, this package is greatly inspired by FOSJsRoutingBundle for Symfony.

License

This package is open-sourced software licensed under the MIT license


All versions of laravel-js-routes with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.0
illuminate/support Version >=5.5
illuminate/console Version >=5.5
illuminate/filesystem Version >=5.5
illuminate/routing 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 macellan/laravel-js-routes contains the following files

Loading the files please wait ....