PHP code example of flo / nimic

1. Go to this page and download the library: Download flo/nimic library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flo / nimic example snippets


/**
 * composer  autoloader:
 */
\NimiKernel; //extend this kernel!

/**
 * This is a Symfony2 container
 */
$container = $kernel->getContainer();

/**
 * with some predefined services, like this (Console Component) application 
 */
$app = $container->get('app');

/**
 * on which you should add your own commands: 
 */
$app->add(new MyCommand);

/**
 * before running it
 */
$app->run();

class YourCustomKernel extends \Flo\Nimic\Kernel\NimiKernel
{
    ...
    /**
     * @return array Array of your own extensions
     */
    protected function getExtensions()
    {
        return [
            new YourExtension()
        ];
    }
    ...
}

$kernel = new \Flo\Nimic\Kernel\NimiKernel;

$kernel = new YourCustomKernel;

#!/usr/bin/env php

/**
 * If you use composer you should use its autoloader:
 */
$loader = e NimiKernel
 * create an extension
 * add its instance to the array returner by YourCustomKernel::getExtensions (so that the extension will be registered before the container gets compiled)
 * make the extension load your services xml or yaml or whatever
 */
$kernel = new Flo\Nimic\Kernel\NimiKernel;

/**
 * If the kernel returns a writable cache dir ( YourCustomKernel::getCacheDir ) then the container is cached
 */
$container = $kernel->getContainer();

/**
 * This is the main entry point for your console application
 * http://symfony.com/doc/current/components/console/index.html
 */
$app = $container->get('app');

/**
 * Here you can add commands using $app->add()
 * The other method of adding commands is through the custom extension, by defining command services tagges "command"
 */

$app->run();