PHP code example of snicco / http-routing-bundle

1. Go to this page and download the library: Download snicco/http-routing-bundle 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/ */

    

snicco / http-routing-bundle example snippets



// /path/to/configuration/bundles.php

use Snicco\Bundle\HttpRouting\HttpRoutingBundle;

return [
    
    'bundles' => [
        Snicco\Component\Kernel\ValueObject\Environment::ALL => [
            HttpRoutingBundle::class
        ]   
    ]   
];



use Snicco\Bundle\HttpRouting\HttpKernelRunner;
use Snicco\Bundle\HttpRouting\WPAdminMenu;
use Snicco\Component\Kernel\Kernel;

// Create kernel

/**
 * @var Kernel $kernel 
 */
$kernel->boot();

/**
 * @var HttpKernelRunner $runner
 */
$runner = $kernel->container()->make(HttpKernelRunner::class);

$is_admin = is_admin();

$runner->listen($is_admin);

if ($is_admin) {
    /**
     * @var WPAdminMenu $admin_menu
     */
    $admin_menu = $kernel->container()->make(WPAdminMenu::class);
    $admin_menu->setUp('my-plugin-text-domain');
}