Download the PHP package uzbek/urlex without Composer

On this page you can find all versions of the php package uzbek/urlex. 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 urlex

Urlex - Use your Laravel Named Routes inside JavaScript

Urlex creates a Blade directive which you can include in your views. This will export a JavaScript object of your application's named routes, keyed by their names (aliases), which you can use to access your routes in your JavaScript.

Installation

  1. Add Urlex to your Composer file: composer require uzbek/urlex

  2. (if Laravel 5.4) Add Uzbek\Urlex\UrlexServiceProvider::class to the providers array in your config/app.php.

  3. Include our Blade Directive (@routes) somewhere in your template before your main application JavaScript is loaded—likely in the header somewhere.

Usage

This package replaces the @routes directive with a collection of all of your application's routes, keyed by their names. This collection is available at Urlex.namedRoutes.

Examples:

Coming soon

Default Values

See Laravel documentation

Default values work out of the box for Laravel versions >= 5.5.29, for the previous versions you will need to set the default parameters by including this code somewhere in the same page as our Blade Directive (@routes)

Filtering Routes

Filtering routes is completely optional. If you want to pass all of your routes to JavaScript by default, you can carry on using Urlex as described above.

Basic Whitelisting & Blacklisting

To take advantage of basic whitelisting or blacklisting of routes, you will first need to create a standard config file called Urlex.php in the config/ directory of your Laravel app and set either the whitelist or blacklist setting to an array of route names.

Note: You've got to choose one or the other. Setting whitelist and blacklist will disable filtering altogether and simply return the default list of routes.

Example config/Urlex.php:

As shown in the example above, Urlex the use of asterisks as wildcards in filters. home will only match the route named home whereas api.* will match any route whose name begins with api., such as api.posts.index and api.users.show.

Simple Whitelisting & Blacklisting Macros

Whitelisting and blacklisting can also be achieved using the following macros.

Example Whitelisting

Example Blacklisting

Advanced Whitelisting Using Groups

You may also optionally define multiple whitelists by defining groups in your config/urlex.php:

In the above example, you can see we have configured multiple whitelists for different user roles. You may expose a specific whitelist group by passing the group key into @routes within your blade view. Example:

Note: Using a group will always take precedence over the above mentioned whitelist and blacklist settings.

Artisan command

Urlex publishes an artisan command to generate a urlex.js routes file, which can be used as part of an asset pipeline such as Laravel Mix.

You can run php artisan urlex:generate in your project to generate a static routes file in resources/assets/js/Urlex.js.

Optionally, include a second parameter to override the path and file names (you must pass a file name with the path):

Example urlex.js, where the named routes home and login exist in routes/web.php:

Contributions & Credits


All versions of urlex with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ~5.4
ext-json Version *
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 uzbek/urlex contains the following files

Loading the files please wait ....