Download the PHP package rtroncoso/laravel-context without Composer

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

Laravel Context

Total Downloads Build Status License

This simple yet powerful package will help you load different Service Providers depending in which context you are. Contexts can be setup using context middleware in your route groups or the Context facade.

It supports both Laravel 5.1.x (release: ^2.0.0) and Laravel 5.0.x (release: ^1.0.0)

What's it for?

Let's say you have 2 contexts in your application: an Administration Panel and a RESTful WebService. This are certainly two completely different contexts as in one context you'll maybe want to get all resources (i.e. including trashed) and in the other one you want only the active ones.

This is when Service Providers come in really handy, the only problem is that Laravel doesn't come with an out of the box solution for loading different Service Providers for different contexts.

This package gives you the possibility to register your different repositories to a single interface and bind them through your Context's Service Provider, using Laravel's amazing IoC Container to resolve which concrete implementation we need to bind depending on which context we are on.

Installation Instructions

To install this package you'll simply need to add this line to your composer.json file:

Laravel 5.0.x

Laravel 5.1.x

After the installation is done, you need to add some stuff to config/app.php:

At the end of your providers array add the following:

At the end of your aliases array add the following:

Then you need to add the context middleware the $routeMiddleware array in your App/Http/Kernel.php file:

And last but not least, run this command to publish context configuration file:

$ php artisan vendor:publish --provider="Cupona\Providers\ContextServiceProvider" --tag="config"

Package Usage

So, here's the fun part! You have two ways of using this package, you can either load different contexts through routes/route groups actions or you can use the Context facade.

Routes & Route Groups

Given the case you want your contexts to be loaded depending on which route or route group you are, you'll simply have to state which context you'll need to load in your routes.php file and create your Service Provider.

Let's see an example, if you want your /admin routes to load the backend context, you'll need to set up your routes.php file like this:

Laravel 5.1.x:

Laravel 5.0.x:

And your BackendServiceProvider should look something like this:

By doing this you've defined your very own contexts in your application, this can be very helpful as you can make sure that when you are in an end user context they will never see your resources as in an administration context.

Note: By default the backend context Service Provider will be loaded in the namespace Contextual\Providers, you can edit this in the configuration file provided by this package (config/context.php)

Context Facade

If you want you can use this package's Context facade and dinamycally load and check which context you are in.

Loading a Context

Checking currently loaded Context


All versions of laravel-context with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 5.1.*
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 rtroncoso/laravel-context contains the following files

Loading the files please wait ....