Download the PHP package teknoo/states-bundle without Composer

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

Teknoo Software - States bundle

SensioLabsInsight Build Status

States allows you to create PHP classes following the State Pattern in PHP. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements and this improve maintainability.

This package is bundle to adapt the library States to Symfony 2+.

Short Example

/**
 * File States/English.php
 */
class English extends \Teknoo\States\State\AbstractState 
{
    public function sayHello(): string
    {
        return 'Good morning, '.$this->name;
    }

    public function displayDate(\DateTime $now): string 
    {
        return $now->format('%m %d, %Y');
    }
}

/**
 * File States/French.php
 */
class French extends \Teknoo\States\State\AbstractState 
{
    public function sayHello(): string
    {
        return 'Bonjour, '.$this->name;
    }

    public function displayDate(\DateTime $now): string 
    {
        return $now->format('%d %m %Y');
    }
}

/**
 * File MyClass.php
 */
class MyClass extends \Teknoo\Bundle\StatesBundle\Entity\IntegratedEntity
{
    /**
     * @ORM\Column(type="string", length=250)
     * @var string
     */
    private $name;

    /**
     * @param string $name
     * @return self
     */
    public function setName(string $name): MyClass
    {
        $this->name = $name;

        return $this;
    }
}

$frenchMan = new MyClass();
$frenchMan->switchState('French');
$frenchMan->setName('Roger');

$englishMan = new MyClass();
$englishMan->switchState('Enflish');
$englishMan->setName('Richard');

$now = new \DateTime('2016-07-01');

foreach ([$frenchMan, $englishMan] as $man) {
    echo $man->sayHello().PHP_EOL;
    echo 'Date: '.$man->displayDate($now);
}

//Display
Bonjour Roger
Date: 01 07 2016
Good morning Richard
Date: 07 01, 2016

Installation & Requirements

This library requires :

* PHP 7+
* Composer
* States 2+
* Symfony 2.7+

Instruction to install the States bundle with Symfony 2+ : Install.

This library support Doctrine, but Doctrine is not mandatory. (Stated classes can be use without Doctrine)

Symfony Use

For main States's features, the bundle is transparent :

With the extension States Life cyclable :

Documentation to use States with Symfony 2+ : Symfony.

Quick startup

Quick How-to to learn how use this library : Startup.

Example

An example of using this library is available in the folder : Demo.

API Documentation

Generated documentation from the library with PhpDocumentor : Open.

Behavior Documentation

Documentation to explain how this library works : Behavior.

Credits

Richard Déloge - [email protected] - Lead developer. Teknoo Software - http://teknoo.software

About Teknoo Software

Teknoo Software is a PHP software editor, founded by Richard Déloge. Teknoo Software's DNA is simple : Provide to our partners and to the community a set of high quality services or software, sharing knowledge and skills.

License

States is licensed under the MIT and GPL3+ Licenses - see the licenses folder for details

Contribute :)

You are welcome to contribute to this project. Fork it on Github


All versions of states-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ~7.0
teknoo/states Version ^3.0.0
container-interop/service-provider Version ^0.3.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 teknoo/states-bundle contains the following files

Loading the files please wait ....