Download the PHP package silverstripe/commandpattern without Composer

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

This is an archived project and is no longer supported or updated by SilverStripe. Please do not file issues or pull-requests against this repo. If you wish to continue to develop this code yourself, we recommend you fork it or contact the maintainers directly (check latest commits for email addresses).

SilverStripe Command Pattern Module

Maintainer Contact

Requirements

Documentation

The commandpattern module enables SilverStripe to decouple business logic from the MVC structure. Commands can be executed individually and have a reference to a calling controller.

To install this module, please clone this module, copy the commands folder into the root folder of the SilverStripe installation and run a dev/build, i.e.:

http://localhost/silverstripe/dev/build

The module consists of a Factory-class which will be used to request command actions. The factory class initiates the command and returns the command object to the calling method, i.e.:

$command = CommandFactory::get_command('Test');

This call will return initiate a TestCommand object and returns the instance. get_command also accepts two optional parameters:

Example

We want to create a command with takes two integer ('x' and 'y') values and when executing the command, it will return the result of x * y.

First create the command class in your project folder:

<?php
class TestCommand extends ControllerCommand {

    public function execute() {
        $data = $this->getParameters();
        $x = $data['x'];
        $y = $data['y'];
        return (int)$x * (int) $y;
    }   
}

Installation Instructions

Add this module into your project folder (name mapping) and run a dev/build to generate the required database schema.

Usage Overview

Implements the command pattern for SilverStripe controllers. This enables the developers to move core business logic into a dedicated command class.

Ideal for de-coupling MVC from core business domain related logic.

Known issues

n/a


All versions of commandpattern with dependencies

PHP Build Version
Package Version
Requires silverstripe/framework Version 3.*
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 silverstripe/commandpattern contains the following files

Loading the files please wait ....