PHP code example of aferrandini / disable-bundle

1. Go to this page and download the library: Download aferrandini/disable-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/ */

    

aferrandini / disable-bundle example snippets

 php

// app/autoload.php

$loader->registerNamespaces(array(
    // ...
    'Ferrandini'        => __DIR__.'/../vendor/bundles',
));
 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...

        new Ferrandini\Bundle\DisableBundle\FerrandiniDisableBundle(),
    );
}
 php


namespace Foo\Bundle\FooBundle\Controller;

use Ferrandini\Bundle\DisableBundle\Annotations\Disable;

/**
 * @Disable()
 */
class FooController {

}
 php


namespace Foo\Bundle\FooBundle\Controller;

use Ferrandini\Bundle\DisableBundle\Annotations\Disable;

class FooController {

    /**
     * @Disable()
     */
    public function fooAction()
    {
        // ...
    }
}
 php


namespace Foo\Bundle\FooBundle\Controller;

use Ferrandini\Bundle\DisableBundle\Annotations\Disable;

/**
 * @Disable(message="This controller has been disabled with DisableBundle")
 */
class FooController {

}
 php


namespace Foo\Bundle\FooBundle\Controller;

use Ferrandini\Bundle\DisableBundle\Annotations\Disable;

/**
 * @Disable(until="2013-11-11 11:11")
 */
class FooController {

}
 php


namespace Foo\Bundle\FooBundle\Controller;

use Ferrandini\Bundle\DisableBundle\Annotations\Disable;

/**
 * @Disable(after="2013-11-11 11:11")
 */
class FooController {

}
 php


namespace Foo\Bundle\FooBundle\Controller;

use Ferrandini\Bundle\DisableBundle\Annotations\Disable;

/**
 * @Disable(until="2013-06-11", after="2013-11-11")
 */
class FooController {

}
 php


namespace Foo\Bundle\FooBundle\Controller;

use Ferrandini\Bundle\DisableBundle\Annotations\Disable;

/**
 * @Disable(redirect="_welcome")
 */
class FooController {

}
 php


namespace Foo\Bundle\FooBundle\Controller;

use Ferrandini\Bundle\DisableBundle\Annotations\Disable;

/**
 * @Disable(statusCode=404)
 */
class FooController {

}