Je tente ceci:
require_once "vendor/Symfony/Component/Console/Application.php";
require_once "vendor/Symfony/Component/Console/Shell.php";
$app = new Application('myapp', '1.0 (stable)');
$app->add(new SimpleCommand());
$app->run();
et j'obtiens l'erreur suivante:
Class 'Application' not found
Pourtant, le fichier [...]/Console/Application.php commence bien ainsi:
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\HelpCommand;
use Symfony\Component\Console\Command\ListCommand;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\DialogHelper;
/**
* An Application is the container for a collection of commands.
*
* It is the main entry point of a Console application.
*
* This class is optimized for a standard CLI environment.
*
* Usage:
*
* $app = new Application('myapp', '1.0 (stable)');
* $app->add(new SimpleCommand());
* $app->run();
*
* @author Fabien Potencier <[email protected]>
*
* @api
*/
class Application
{
Pourquoi ne puis-je donc pas créé cet objet ?
J'avais antérieurement tenté ceci:
require_once "vendor/Symfony/Component/Console/Application.php";
require_once "vendor/Symfony/Component/Console/Shell.php";
$process = new Shell();
et j'obtins le même message d'erreur
Class 'Shell' not found
Alors que lui aussi commence par une définition de classe:
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Process\PhpExecutableFinder;
/**
* A Shell wraps an Application to add shell capabilities to it.
*
* Support for history and completion only works with a PHP compiled
* with readline support (either --with-readline or --with-libedit)
*
* @author Fabien Potencier <[email protected]>
* @author Martin Hasoň <[email protected]>
*/
class Shell
{
Merci
Je tente ceci:
[PHP]require_once "vendor/Symfony/Component/Console/Application.php";
require_once "vendor/Symfony/Component/Console/Shell.php";
$app = new Application('myapp', '1.0 (stable)');
$app->add(new SimpleCommand());
$app->run();
[/PHP]
et j'obtiens l'erreur suivante:
[color=#FF0000]Class 'Application' not found
[/color]
Pourtant, le fichier [...]/Console/Application.php commence bien ainsi:
[PHP]
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <
[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\HelpCommand;
use Symfony\Component\Console\Command\ListCommand;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\DialogHelper;
/**
* An Application is the container for a collection of commands.
*
* It is the main entry point of a Console application.
*
* This class is optimized for a standard CLI environment.
*
* Usage:
*
* $app = new Application('myapp', '1.0 (stable)');
* $app->add(new SimpleCommand());
* $app->run();
*
* @author Fabien Potencier <
[email protected]>
*
* @api
*/
class Application
{
[/PHP]
Pourquoi ne puis-je donc pas créé cet objet ?
J'avais antérieurement tenté ceci:
[PHP]require_once "vendor/Symfony/Component/Console/Application.php";
require_once "vendor/Symfony/Component/Console/Shell.php";
$process = new Shell();
[/PHP]
et j'obtins le même message d'erreur
[color=#FF0000]Class 'Shell' not found
[/color]
Alors que lui aussi commence par une définition de classe:
[PHP]
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <
[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Process\PhpExecutableFinder;
/**
* A Shell wraps an Application to add shell capabilities to it.
*
* Support for history and completion only works with a PHP compiled
* with readline support (either --with-readline or --with-libedit)
*
* @author Fabien Potencier <
[email protected]>
* @author Martin Hasoň <
[email protected]>
*/
class Shell
{
[/PHP]
Merci