Download the PHP package haihv433/sagoboot without Composer

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

SagoBoot

SagoBoot | The mini-framework for scalable PHP application

There is no principle when using this package or any, just blump your mind

The key archive

SagoBoot, which designed small enough to inject in any complex and not highly architect such as WordPress, Drupal ... using for theming and plugins.

SagoBoot, which designed to scale up more efficiently, by using Composer packages and PSR-4: Autoloader, out of the box, you can use it beside Symfony or Zend for the first routing or destructor ...

SagoBoot, which designed for ease to use, quicky start, flexible and compatible for any idea and projects.

Installation

Install from Composer

composer require haihv433/sagoboot

Or just clone repo from github

git clone [email protected]:haihv433/sagoboot.git

Application and Loader

The first important thing when creating your own application is the App class manager, which holds all the instances

See class SagoBoot\Sample\App\App for a sample

Your Application Manager needs to extend from \SagoBoot\Application

In your bootstrap.php you can control when your application booting, such as add Autoloader

// Initlize your application
$app = new \SagoBoot\Sample\App\App();

// Set your new class as App manager
// that then, your system will cheat \SagoBoot\Sample\App as a Manager instead of \SagoBoot\Application
$app->bind('SagoBoot\Sample\App', 'App', 1);

// SagoBoot do call your Loader when system boot
// Before that, you can add the logic more
$app->addEvent('boot', function ( \SagoBoot\Sample\App\Loader $loader) use ($app) {
    $app->make('Autoload')->addLoader($loader);
});

Look at your own sample loader \SagoBoot\Sample\App\Loader

// This method will call automatically when system boot
public function autoload(Modules\Loader $loader)
{
    $loader->loadPath(__DIR__ . '/../autoload.php');
}

As you see, Loader using a file named autoload.php, take a look of this those lines:

[
    'abstract' => \SagoBoot\Sample\Car\Car::class, 
    'make' => false, 
    'singleton' => true, 
    'aliases' => [ 
        \SagoBoot\Sample\Car\CarInterface::class
     ]
]

The file contains an array, each element has configuration:

abstract: Define your class

make: Set true if your want system constructs them automatically, or otherwise.

singleton: Set instances as Singleton that allow accessing as the same

aliases: You can hide your real logic when using aliases pattern, check class \SagoBoot\Sample\Car\CarInterface for a sample.

Finally, don't forget to boot your system.

$app = require_once(__DIR__ . "/sample/bootstrap.php");
// Now booting
$app->boot();

Dependency Injection

Now, if you'd finished declaring your Application, no more effort to construct your class, just inject any class you needed

The MakeCar sample class

namespace SagoBoot\Sample;

class MakeCar
{
    public function __construct(
        \SagoBoot\Sample\Garage $garage,
        \SagoBoot\Sample\Car\CarInterface $car
    )
    {
    }
}

the Garage sample class

namespace SagoBoot\Sample;

class Garage
{
    /**
     * @var \SagoBoot\Sample\Car\CarInterface
     */
    protected $car;

    public function __construct(
        \SagoBoot\Sample\Car\CarInterface $car
    )
    {
        $this->car = $car;
    }
}

As you see above, no need to add the new keyword when create class, which is already set in autoload.php

The Application also check the aliases for a reflection from real class to alias

In this case, calling interface \SagoBoot\Sample\Car\CarInterface will return an instance of \SagoBoot\Sample\Car\Car

Singleton

If you set your class as singleton in autoload.php or implements from \SagoBoot\Support\Singleton, your Application will treat what one as Singleton object, that mean, calling or injection will return the same object.

See this in MakeCar.php::__construct()

    $car->start()
        ->observerState()
        ->addFuel()
        ->observerState()
        ->stop();

    $garage->maintenanceCar();

    $car->observerState();

By running command php index.sample.php

Output:

Your car is: RUNNING.
Your car is: REFUEL.
Your car is: RUNNING.
Your car is: MAINTENANCE.
The car was destroyed.

For calling the instance of Car class, these methods could useful:

Event

If you are noted, your application only boots when call $app->boot(), look more closely in this method:

$this->make('EventsHelper')->fire('boot');

The event boot is a system designed for booting, for that, you can add your custom logic after or before system boot, see this:

$app->addEvent('your_custome_event', function() {
      // Your logical
});

$app->addEvent('boot', function() {

    $this->make('EventsHelper')->fire('your_custome_event');
})

API Functional

For more convenient when interact with your application, please check helpers.php for more options:

Practical

Do you love design pattern and how to implement them all, those articles might useful

There is no principle when implement SagoBoot with any pattern, Factory, Proxy, Repo ... whatever, you already have a skeleton, just do it !!!


All versions of sagoboot with dependencies

PHP Build Version
Package Version
Requires php Version ~7.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 haihv433/sagoboot contains the following files

Loading the files please wait ...