Download the PHP package zendraxl/laravel-request-null-user without Composer

On this page you can find all versions of the php package zendraxl/laravel-request-null-user. 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-request-null-user

Laravel Request Null User

Null Object Pattern for User fetched from Request for Laravel framework.

Install

To install just run following command from terminal:

composer require zendraxl/laravel-request-null-user

Usage

Since the user() method is already taken on \Illuminate\Http\Request object, this package provides owner() method cause it makes some sense that the person that made the request is the owner of that request.

You can use any of these:

Object returned by the owner() method is an instance of \Zendraxl\LaravelRequestNullUser\Owner. It is a simple wrapper/decorator so \App\User class does not have to be modified.

What this is allowing for is, that it can somewhat guarantee the same API across both \App\User and \Zendraxl\LaravelRequestNullUser\NullUser objects without code duplication and respecting the DRY (Don't Repeat Yourself).

Only method defined on the \Zendraxl\LaravelRequestNullUser\Owner object is isGuest() method. This method will return true if the visitor is not authenticated, and false if the visitor is authenticated.

Defaults

Out of the box \Zendraxl\LaravelRequestNullUser\NullUser comes with following public properties:

All of them can be accessed directly through the \Zendraxl\LaravelRequestNullUser\Owner object:

Each default can be changed by defining following env variables:

Extend

\Zendraxl\LaravelRequestNullUser\Owner object is extendable via Macros since it is using Illuminate\Support\Traits\Macroable trait.

Add isAdmin() method to \Zendraxl\LaravelRequestNullUser\Owner:

Additional isType() methods can be also added to the \Zendraxl\LaravelRequestNullUser\Owner object with env variable ZENDRAXL_USER_TYPES. By adding a comma separated list of types everything will be generated on the fly.

If the database has admin, manager, supervisor, pro user, user types on the \App\User model and this is added to the .env file:

then the following methods will be added to the \Zendraxl\LaravelRequestNullUser\Owner object:

If the property on the \App\User model is not type but something like role, then override it with env variable


All versions of laravel-request-null-user with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
illuminate/support Version ^5.7.15 || ^6.0.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 zendraxl/laravel-request-null-user contains the following files

Loading the files please wait ....