helhum / typo3-frontend-request
API to execute TYPO3 frontend requests from code or command line
Installs: 1 687
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 4
Forks: 1
Open Issues: 1
Requires
- php: >=7.2
- symfony/process: ^5.0 || ^6.0 || ^7.0
- typo3/cms-core: ^10.4 || ^11.5 || ^12.4
Suggests
- helhum/typo3-console: For a cli interface
This package is auto-updated.
Last update: 2024-12-17 19:40:20 UTC
README
This package provides an API to get a response from any TYPO3 frontend request in any context, without the need to do an actual HTTP request.
Examples:
Doing a TYPO3 frontend request
$request = new \TYPO3\CMS\Core\Http\ServerRequest($uri); $client = new \Helhum\Typo3FrontendRequest\Typo3Client(); try { $response = $client->send($request); $body = (string)$response->getBody(); } catch (\Helhum\Typo3FrontendRequest\RequestFailed $e) { throw new \RuntimeException('Could not fetch page "' . $uri . '", reason: ' . $e->getMessage(), 1552081550, $e); }
Doing a TYPO3 frontend request with a user being authenticated
$request = new \TYPO3\CMS\Core\Http\ServerRequest($uri) $request = $request->withHeader( 'x-typo3-frontend-user', (string)$context->getPropertyFromAspect('frontend.user', 'id') ); $client = new \Helhum\Typo3FrontendRequest\Typo3Client(); $response = $client->send($request); $body = (string)$response->getBody();