Download the PHP package zumba/swivel-cake without Composer

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

CakePHP Plugin for Zumba Swivel

Zumba Swivel is a library that allows PHP applications to manage features to multiple users via buckets. It consists with 10 buckets, allowing the same code have up to 10 different behaviors.

This plugin is a bridge between CakePHP and Swivel. It provides a helper, component and behavior classes to be used in your CakePHP application.

Installation

You can install Swivel Cake into your project using composer. For existing applications you can add the following to your composer.json file:

And run php composer.phar update

Loading the Plugin

After installing, you should tell your application to load the plugin:

Configuration

The plugin has default configurations and is ready to use. However, you can customize some of the configurations.

Configuration Default Value Description
Cookie.enabled true If cookie should be set at all
Cookie.name Swivel_Bucket Cookie name used to store the client bucket number.
Cookie.expire 0 Expiration, in seconds, of the cookie. Setting 0 means a session cookie.
Cookie.path / Cookie's path.
Cookie.domain env('HTTP_HOST') Domain name used for the cookie.
Cookie.secure false If cookie can be only used in secure transmissions, ie. HTTPS
Cookie.httpOnly false If cookie can be accessed via other sources other than HTTP, ie. JavaScript
BucketIndex null Defines the user's bucket. Leaving null it will auto-generate a number between 1 and 10.
LoaderAlias SwivelManager Name that will be used to store the instance on Cake's ClassRegistry.
Logger null Instance to receive the logs. Setting to null will make the log be discarded.
Metrics null Metrics instance.
ModelAlias Swivel.SwivelFeature Model name that will provide the swivel mapping configuration.

To set custom configurations, you need to create a file in APP/Config/swivel.php and set the fields you want to override. Here is the default configuration file:

Let's say for an example that you want to reserve one bucket for your testing and give the other 9 buckets to your customers, you can do something like this:

Loading Feature List

In order to Swivel to work, you need to specify which features are enabled for each bucket.

Loading Feature via Database

The default behavior from swivel-cake is to load the features from database. This is done via the built-in class Swivel.SwivelFeature. This class However expects the table swivel_buckets to exist in your default database configuration.

This is the minimum table structure:

Feel free to add more fields if you want. For example, at Zumba we have the field modified that automatically auto-update when we change the buckets configuration. If you rename one of the pre-defined fields you will have to extends the plugin model and update accordingly.

Note the buckets are in a string field, separated by comma. You should not add spaces between the numbers.

Loading via Custom Source

You can also load the feature list from any other source, ie. from a webservice that you use to share across all your apps.

In order to do that, create a model and make this model to implement SwivelModelInterface interface. Example, I will call my model MySwivelFeature:

Using

Either the component, behavior and helper implement the methods forFeature and invoke, which are part of swivel. You can check the details of these methods in Swivel's documentation.

To exemplify in CakePHP application:

This is just an example of how you can use the plugin in the controller, but you can also use it on your models and views.


All versions of swivel-cake with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
composer/installers Version ^1.0
zumba/swivel Version 2.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 zumba/swivel-cake contains the following files

Loading the files please wait ....