Download the PHP package davidyell/statusable without Composer

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

CakePHP-Statusable

A CakePHP plugin which will take out the hassle of managing the status of items in a web application. I am always adding a Status model and status_id fields to my models so that I can mark them as active or inactive.

End of life

This plugin has now reached end of life, and no further updates will be made. If you are looking for a CakePHP 3 plugin with similar functionality, please see the UseMuffin/Trash plugin.

What does it do?

The behaviour, when attached to a model, will deal with the filtering of finds automatically so that items which have specific statuses will not be displayed to users. It will also allow soft deletion by just changing the status of a record to 'deleted' rather than removing it.

There is also a method to allow you to pull a list of statuses from the behaviour to display in your admin for users to change the status of a record.

Assumptions

This plugin makes just one simple assumptions about your application.
You have an admin area to administer content, probably using the admin prefix
This assumption is because you will want to display some items to front-end users and some different items to the administrator users. The switching will work based on the routing prefix.

Configuration

You need to load the plugin in your app/Config/bootstrap.php using CakePlugin::load('Statusable'). You can use CakePlugin::loadAll() but it's slow.

Database

You will also need a table to store your statuses. You can create the default using the following.

Once the table is created, you'll need to populate it with some statuses for the behaviour to use. An example might be,

You'll need to create the fields for the status_id and also the deleted_date in your database tables, for each model to which you attach the behaviour. You can name these differently if you want to but you'll have to remember to configure them when you attach the behaviour to the model.
Don't forget to set the status_id fields default value to your default status. For example 2 for inactive.
Also the deleted_date field will need to be a DATETIME field.

Attach the behaviour to your model

Configuration options can be passed to the behaviour here if your configuration differs from the default. You can find the default options in the behaviour source code in $defaults.

Add component to controller

In your controller, you'll need to add the component. I'm hoping to be able to get rid of this at some point, but for the meantime, it's needed to get at the routing.

Load statuses in views

If you want to add a status_id field to your add and edit actions, the behaviour has a handy method to return a list of statuses.

Proposed features

Honourable mentions

I also make use of the CakeDC/Utils/SoftDelete behaviour on a regular basis, so this takes inspiration from there. So a generous tip of the hat to the CakeDC guys.


All versions of statusable with dependencies

PHP Build Version
Package Version
Requires composer/installers Version ~1.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 davidyell/statusable contains the following files

Loading the files please wait ....