Download the PHP package chippyash/record-status without Composer

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

chippyash/RStatus

Quality Assurance

PHP 5.6 PHP 7 Build Status Test Coverage Maintainability

See the Test Contract

What?

Provides a simple helper capability for managing record or class status

Why?

When dealing with database records, there is often a case for never deleting the record. This can be because you either don't want to lose the data, or you need it in place to ensure referential integrity with other data.

This small library provides the interfaces and traits to add a status functionality to any class.

Roadmap

If you want more, either suggest it, or better still, fork it and provide a pull request.

Check out ZF4 Packages for more packages

How

A record can be in one of three states:

Whilst the library provides support to manage the record status, you should also bear in mind that you will need to provide additional support to check the status in any of your other methods in a class.

In the docs directory, you'll also find an example trigger that you can use in MySql or MariaDb database server to maintain status integrity.

Coding Basics

Record Status Enum class

The Chippyash\RStatus\RecordStatus class is provided to provide the three possible states as a an Enum(erator) using the MyCLabs Enum library.

use Chippyash\RStatus\RecordStatus;

//create status objects
$status = RecordStatus::ACTIVE();
$status = RecordStatus::SUSPENDED();
$status = RecordStatus::DEFUNCT();

//test if status can be changed
if ($status->canChange()) {
    //....
}

Enabling RecordStatus for your class

Have your class implement the RecordStatusRecordable interface. Use the RecordStatusRecording trait as a convenient implementation of the interface.

use Chippyash\RStatus\RecordStatusRecordable;
use Chippyash\RStatus\RecordStatusRecording;

class MyRecord implements RecordStatusRecordable
{
    use RecordStatusRecording;
}

The RecordStatusRecording trait provides a protected $recordStatus propertyand the following methods:

/**
 * Return the record status
 *
 * @return RecordStatus
 */
public function getStatus();

/**
 * Set the record status
 *
 * @param RecordStatus $status
 *
 * @return $this
 *
 * @throws RecordStatusException
 */
public function setStatus(RecordStatus $status);

/**
 * Is record status == active
 *
 * @return bool
 */
public function isStatusActive();

/**
 * Is record status == suspended
 *
 * @return bool
 */
public function isStatusSuspended();

/**
 * Is record status == defunct
 *
 * @return bool
 */
public function isStatusDefunct();

Changing the library

  1. fork it
  2. write the test
  3. amend it
  4. do a pull request

Found a bug you can't figure out?

  1. fork it
  2. write the test
  3. do a pull request

NB. Make sure you rebase to HEAD before your pull request

Or - raise an issue ticket.

Where?

The library is hosted at Github. It is available at Packagist.org

Installation

Install Composer

For production

    "chippyash/record-status": ">=1,<2"

For development

Clone this repo, and then run Composer in local repo root to pull in dependencies

    git clone [email protected]:chippyash/record-status.git
    cd record-status
    composer install

To run the tests:

    cd record-status
    vendor/bin/phpunit -c test/phpunit.xml test/

License

This software library is released under the GNU GPL V3 or later license

This software library is Copyright (c) 2017, Ashley Kitson, UK

A commercial license is available for this software library, please contact the author. It is normally free to deserving causes, but gets you around the limitation of the GPL license, which does not allow unrestricted inclusion of this code in commercial works.

History

V1.0.0 Original release

V1.0.1 build integration

V1.0.2 typos


All versions of record-status with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
myclabs/php-enum Version >=1.5.2,<2
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 chippyash/record-status contains the following files

Loading the files please wait ....