PHPackages                             morningtrain/laravel-context - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. morningtrain/laravel-context

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

morningtrain/laravel-context
============================

A context helper package for Laravel

3.1.0(2y ago)32.9k3GPL-3.0-onlyPHPPHP ^7.4|^8.0|^8.1

Since Mar 19Pushed 2y ago3 watchersCompare

[ Source](https://github.com/Morning-Train/LaravelContext)[ Packagist](https://packagist.org/packages/morningtrain/laravel-context)[ Docs](http://morningtrain.dk/)[ RSS](/packages/morningtrain-laravel-context/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (41)Used By (3)

Context
=======

[](#context)

Installation
------------

[](#installation)

The Laravel Context package can be installed from packagist using the follow command

`composer require morningtrain/laravel-context`

### Facade setup

[](#facade-setup)

There is a facade helper for accessing the current context. Add it as an alias to **config/app.php** using the following snippet.

`'Context' => MorningTrain\Laravel\Context\Context::class,`

### Service provider

[](#service-provider)

Contexts are configured in a service provider. Add a service provider in **app/Providers** that extends *MorningTrain\\Laravel\\Context\\ContextServiceProvider*

This could be a typical starter ContextServiceProvider which also should be registered in the **config/app.php** config file in Laravel.

```
