Download the PHP package sebastiansulinski/laravel-routes without Composer

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

Route Collections and Route Model Binding wrappers for Laravel

No longer maintained

[DEPRECATED] This repository is no longer maintained

While this project is functional with older versions of Laravel, the dependencies are no longer up to date. You are still welcome to explore, learn, and use the code provided here.

Route collections

Crate a new directory that will store all route collections for your application - example would be directory called Routes/Collections under app/Http.

Inside the directory create a new class that will be used with the given section of your system - say for the Front end of your application, we use FrontCollection.php and we put it into another directory - to distinguish between sections - because this one belongs to the front end, we call it Front.

The new FrontCollection class will extend the SSD\LaravelRoutes\RouteCollectionFactory and needs to have the method getNameSpace that returns the current namespace, which will be used to create a fully qualifying name of each class within the app/Http/Routes/Collections/Front directory.

Inside the same directory create a new file for each collection of routes - say for the Blog module of your Front section you could use:

and perhaps another one for the Contact Controller with form submission method:

Now all you need to do in your app/Http/routes.php file is:

The magically called static methods on the FrontCollection are names of the collection classes in camelCase - say for instance collection with name FoodRecepies would be called as FrontCollection::foodRecepies() and so on.

If you want to keep your routes.php file even cleaner, you could create a master collection for each section and then enclose all separate route collections inside of it

and for the Admin section (make sure you first create AdminCollection)

Then simply call it from within the routes.php

Custom exceptions

The abstract SSD\LaravelRoutes\RouteCollectionFactory class can throw either SSD\LaravelRoutes\Exceptions\InvalidClassName when the static method name does not correspond to the existing class or SSD\LaravelRoutes\Exceptions\MissingNamespace when you forget to declare the getNameSpace() method on the class extending SSD\LaravelRoutes\RouteCollectionFactory.

Route model binder

Route model binder allows you to group model bindings.

To start, create a new directory under app/Http/Routes called ModelBindings

Inside this directory create a class corresponding to the model you are trying to define bindings for - for instance, if you had a Blog model on which you'd like to define two bindings - one for blog_id and the other for the blog_slug

your model would look like so

Add the scopeWhereSlug() method to your Blog model (or, if you're using slugs on more than one model you could extract it to a Trait)

Now, with the BlogBinder ready, we can add it to the `app/Providers/RouteServiceProvider.php'

Model binding tip

You are more likely to use slug with the front end of your application - so just to boost the performance a bit, let's cache the model for the slug binding. To do this - create a new, BaseBinder class under App\Http\Routes\ModelBindings and to make it easier - let's use nespot/carbon package. First add Carbon dependency with the composer.

Now create BaseBinder class with the cache method. I'm caching for just one day, but feel free to make it as long as you need

Finally modify the BlogBinder class

And now your model binding will first be served from the database, then, every sub-sequent call will be read from cache for a length of one day. Make sure that when you update record - you also update cached version - or simply remove cache for a corresponding key.


All versions of laravel-routes with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/routing Version ^5.0
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 sebastiansulinski/laravel-routes contains the following files

Loading the files please wait ....