virge/project

There is no license information available for the latest version (v1.2.1) of this package.

v1.2.1 2017-03-29 04:51 UTC

This package is not auto-updated.

Last update: 2024-05-07 18:51:39 UTC


README

Used to create a new empty Virge project, including most used virge libraries (virge/core, virge/db, virge/router, virge/orm)

Adding your code

Simply add your namespace in the src/ directory, and add your Namespace to the bootstrap.php file.

Capsules

Virge projects are split into Capsules, you register all capsules in the Reactor (app/Reactor.php). Each Capsule must be defined as follows:

namespace Siosphere\MyCapsule;

/**
 * 
 */
class Capsule extends \Virge\Core\Capsule {
    public function registerCapsule() {
        
    }
}

Virge will automatically read all configuration files in the config directory of your capsule. This directory is where you will register new services, routes, and API calls.

Registering Services

Let's say we have the capsule src\Siosphere\MyCapsule, and we had a service Siosphere\MyCapsule\Service\TestService. Create a file called services.php in the src\Siosphere\MyCapsule\config\ directory.

use Siosphere\MyCapsule\Service\TestService;
use Virge\Virge;

Virge::registerService("my_service_identifier", new TestService());