Download the PHP package philspil66/gatekeeper without Composer

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

Gatekeeper

Gatekeeper is a package to manage Feature Flagging within a Laravel project.

What is Feature Flagging?

Feature Flagging is basically a way to have full control on the activation of a feature in your applications.

Let's make a couple of examples to give you an idea:

With Gatekeeper, you can:

There are many things to know about feature toggling: take a look to this great article for more info. It's a really nice and useful lecture.

Compatibility

Gatekeeper works with PHP 5.6 or above.

Install

You can install Gatekeeper with Composer.

After that, you need to add the FeatureServiceProvider to the app.php config file.

Now you have to run migrations, to add the tables Gatekeeper needs.

... and you're good to go!

Facade

If you want, you can also add the Feature facade to the aliases array in the app.php config file.

If you don't like Facades, inject the FeatureManager class wherever you want!

Config File

By default, you can immediately use Gatekeeper. However, if you want to tweak some settings, feel free to publish the config file with

Basic Usage

There are two ways you can use features: working with them globally or specifically for a specific entity.

Globally Enabled/Disabled Features

Declare a New Feature

Let's say you have a new feature that you want to keep hidden until a certain moment. We will call it "new_super_feature". Let's add it to our application:

Easy, huh? As you can imagine, the first argument is the feature name. The second is a boolean we specify to define the current status of the feature.

And that's all.

Check if a Feature is Enabled

Now, let's imagine a better context for our example. We're building a CMS, and our "new_super_feature" is used to... clean our HTML code. Let's assume we have a controller like this one.

Now, we want to deploy the new service, but we don't want to make it available for users, because the marketing team asked us to release it the next week. Gatekeeper helps us with this:

Now, the specific service code will be executed only if the "new_super_feature" feature is enabled.

Change a Feature Activation Status

Obviously, using the Feature class we can easily toggle the feature activation status.

Remove a Feature

Even if it's not so used, you can also delete a feature easily with

Warning: be sure about what you do. If you remove a feature from the system, you will stumble upon exceptions if checks for the deleted features are still present in the codebase.

Work with Views

I really love blade directives, they help me writing more elegant code. I prepared a custom blade directive, @feature:

A really nice shortcut!

Enable/Disable Features for Specific Users/Entities

Even if the previous things we saw are useful, Gatekeeper is not just about pushing the on/off button on a feature. Sometimes, business necessities require more flexibility. Perhaos we want to rollout a feature only to specific users. Or, maybe, just for one tester user.

Enable Features Management for Specific Users

Gatekeeper makes this possible, and also easier just as adding a trait to our User class.

In fact, all you need to do is to:

Nothing more! Gatekeeper now already knows what to do.

Status Priority

Please keep in mind that all you're going to read from now is not valid if a feature is already enabled globally. To activate a feature for specific users, you first need to disable it.

Gatekeeper first checks if the feature is enabled globally, then it goes down at entity-level.

Enable/Disable a Feature for a Specific User

Check if a Feature is Enabled for a Specific User

Artisan Commands

You may run the following commands to add or remove features.

You may run the following commands to toggle the on or off state of the feature.

Other Notes

Gatekeeper also provides a Blade directive to check if a feature is enabled for a specific user. You can use the @featurefor blade tags:

Advanced Things

Ok, now that we got the basics, let's raise the bar!

Enable Features Management for Other Entities

As I told before, you can easily add features management for Users just by using the Featurable trait and implementing the FeaturableInterface in the User model. However, when structuring the relationships, I decided to implement a many-to-many polymorphic relationship. This means that you can add feature management to any model!

Let's make an example: imagine that you have a Role model you use to implement a basic roles systems for your users. This because you have admins and normal users.

So, you rolled out the amazing killer feature but you want to enable it only for admins. How to do this? Easy. Recap:

Let's think the role-user relationship as one-to-many one.

You will probably have a role() method on your User class, right? Good. You already know the rest:

Change log

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of gatekeeper with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
illuminate/database Version ^5.8|^6.0|^7.0|^8.0
illuminate/support Version ^5.6|^6.0|^7.0|^8.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 philspil66/gatekeeper contains the following files

Loading the files please wait ....