Skip to content

Commit c963d54

Browse files
committed
[Runtime] Remove "docs" from readme
1 parent 470ef6c commit c963d54

File tree

1 file changed

+1
-95
lines changed

1 file changed

+1
-95
lines changed

README.md

Lines changed: 1 addition & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -8,104 +8,10 @@ Symfony Runtime enables decoupling applications from global state.
88
are not covered by Symfony's
99
[Backward Compatibility Promise](https://symfony.com/doc/current/contributing/code/bc.html).
1010

11-
Getting Started
12-
---------------
13-
14-
```
15-
$ composer require symfony/runtime
16-
```
17-
18-
RuntimeInterface
19-
----------------
20-
21-
The core of this component is the `RuntimeInterface` which describes a high-order
22-
runtime logic.
23-
24-
It is designed to be totally generic and able to run any application outside of
25-
the global state in 6 steps:
26-
27-
1. the main entry point returns a callable that wraps the application;
28-
2. this callable is passed to `RuntimeInterface::getResolver()`, which returns a
29-
`ResolverInterface`; this resolver returns an array with the (potentially
30-
decorated) callable at index 0, and all its resolved arguments at index 1;
31-
3. the callable is invoked with its arguments; it returns an object that
32-
represents the application;
33-
4. that object is passed to `RuntimeInterface::getRunner()`, which returns a
34-
`RunnerInterface`: an instance that knows how to "run" the object;
35-
5. that instance is `run()` and returns the exit status code as `int`;
36-
6. the PHP engine is exited with this status code.
37-
38-
This process is extremely flexible as it allows implementations of
39-
`RuntimeInterface` to hook into any critical steps.
40-
41-
Autoloading
42-
-----------
43-
44-
This package registers itself as a Composer plugin to generate a
45-
`vendor/autoload_runtime.php` file. This file shall be required instead of the
46-
usual `vendor/autoload.php` in front-controllers that leverage this component
47-
and return a callable.
48-
49-
Before requiring the `vendor/autoload_runtime.php` file, set the
50-
`$_SERVER['APP_RUNTIME']` variable to a class that implements `RuntimeInterface`
51-
and that should be used to run the returned callable.
52-
53-
Alternatively, the class of the runtime can be defined in the `extra.runtime.class`
54-
entry of the `composer.json` file.
55-
56-
A `SymfonyRuntime` is used by default. It knows the conventions to run
57-
Symfony and native PHP applications.
58-
59-
Examples
60-
--------
61-
62-
This `public/index.php` is a "Hello World" that handles a "name" query parameter:
63-
```php
64-
<?php
65-
66-
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
67-
68-
return function (array $request, array $context): void {
69-
// $request holds keys "query", "body", "files" and "session",
70-
// which map to $_GET, $_POST, $_FILES and &$_SESSION respectively
71-
72-
// $context maps to $_SERVER
73-
74-
$name = $request['query']['name'] ?? 'World';
75-
$time = $context['REQUEST_TIME'];
76-
77-
echo sprintf('Hello %s, the current Unix timestamp is %s.', $name, $time);
78-
};
79-
```
80-
81-
This `bin/console.php` is a single-command "Hello World" application
82-
(run `composer require symfony/console` before launching it):
83-
```php
84-
<?php
85-
86-
use Symfony\Component\Console\Command\Command;
87-
use Symfony\Component\Console\Input\InputInterface;
88-
use Symfony\Component\Console\Output\OutputInterface;
89-
90-
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
91-
92-
return function (Command $command) {
93-
$command->addArgument('name', null, 'Who should I greet?', 'World');
94-
95-
return $command->setCode(function (InputInterface $input, OutputInterface $output) {
96-
$name = $input->getArgument('name');
97-
$output->writeln(sprintf('Hello <comment>%s</>', $name));
98-
});
99-
};
100-
```
101-
102-
The `SymfonyRuntime` can resolve and handle many types related to the
103-
`symfony/http-foundation` and `symfony/console` components.
104-
Check its source code for more information.
105-
10611
Resources
10712
---------
10813

14+
* [Documentation](https://symfony.com/doc/current/components/runtime.html)
10915
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
11016
* [Report issues](https://github.com/symfony/symfony/issues) and
11117
[send Pull Requests](https://github.com/symfony/symfony/pulls)

0 commit comments

Comments
 (0)