Download the PHP package dive-be/laravel-feature-flags without Composer

On this page you can find all versions of the php package dive-be/laravel-feature-flags. 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-feature-flags

⛳️ - Abandoned

Please use much better alternatives:

What problem does this package solve?

"A feature flag is a software development process used to enable or disable functionality remotely without deploying code. New features can be deployed without making them visible to users. Feature flags help decouple deployment from release letting you manage the full lifecycle of a feature." (Source)

Installation

You can install the package via composer:

Once composer has finished, you must publish the configuration and migration:

This is the contents of the published config file:

If you don't need multi-locale support, you are now good to go.

Multiple languages support

This package provides first-class support for multiple languages using Spatie's excellent Laravel translatable package.

Next, go to the configuration file and change feature_model to:

Finally, find the migration and uncomment the comment while also deleting everything in front of it. It should read:

Usage

For a full list of what's available to you, please refer to the Feature contract for an exhaustive list.

Setting up your app's initial features

Seeding the (initial) features can be done in a regular Laravel seeder.

Here is an example of what it might look like:

Resolving the manager

This package provides every possible way to resolve a Feature instance out of the IoC container. We've got you covered!

Facade

or using the alias (particularly helpful in Blade views)

Helpers

Dependency injection

Service Location

Scoping

The package allows you to define a custom scope along with the feature (not to be confused with Laravel's global scopes). Particularly useful when you need to use the same name for different parts of your application. Most of the package's functions/methods accept an additional $scope argument.

Refer to the Feature contract for an exhaustive list.

Changing the default wildcard scope

If you wish to use a different scope rather than the * sign the package uses by default when creating and checking/verifying features, you may change this in your AppServiceProvider's boot method:

Seeding

Refer to the seeding section above on how to scope your features.

Blade directives 🗡

@disabled

You can use the @disabled directive to conditionally display content in your views depending on a feature's current state. Using this directive first will make the feature's message property automatically available as a scoped variable inside the block. Examples:

@enabled

You can also use the @enabled directive to do the same thing as above. However, the $message variable will not be available inside the @disabled block when using this directive first.

@can(not)

This package also registers itself at Laravel's Gate. The visitor does not have to be auhenticated in order to use it:

Guarding parts of your application 💂🏼

There are multiple ways to prevent users from accessing disabled parts of your application.

A FeatureDisabledException will be thrown in all cases if the feature is not enabled.

Route middleware

Manual checking using 'verify'

Controller example

Assume your typical controller:

Livewire example

This is especially useful in contexts where you cannot really use route middleware, such as Livewire actions:

PS: Be sure to check out our Wishlist package as well 😉

Access Gate

This package also registers itself at Laravel's Gate providing you the ability to check a feature's state through them. This means that you can do things like the following:

However, there is one key difference. Laravel's Gate will throw an AccessDeniedHttpException, while the package's own checks will throw a FeatureDisabledException (which extends the former exception class). So, if you need to know the exception's type, you are highly adviced not to use gates.

Artisan commands 🧑‍🎨

Toggling a feature on/off

Since the features are managed through a Feature Eloquent model, you can definitely use solutions such as Laravel Nova to do this.

However, when developing locally, you might want to easily turn a feature on/off. You can do this using the command below:

Displaying list of all features

Use the command below to display a table of all features and their corresponding state:

Available options: compact, disabled, enabled, scope.

Clearing the cache

The features are cached forever to speed up subsequent checks. If you don't use Eloquent to update or alter records, you must reset the cache manually:

Note: when you create/update features through Eloquent, the cache busting is done for you automatically.

Testing

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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


All versions of laravel-feature-flags with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/auth Version ^9.0
illuminate/cache Version ^9.0
illuminate/console Version ^9.0
illuminate/contracts Version ^9.0
illuminate/database Version ^9.0
illuminate/events Version ^9.0
illuminate/http Version ^9.0
illuminate/support Version ^9.0
illuminate/view Version ^9.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 dive-be/laravel-feature-flags contains the following files

Loading the files please wait ....