项目作者: sdaoudi

项目描述 :
SfForward Bundle
高级语言: PHP
项目地址: git://github.com/sdaoudi/sf-forward.git
创建时间: 2018-03-11T14:26:50Z
项目社区:https://github.com/sdaoudi/sf-forward

开源协议:MIT License

下载


Symfony Requests Forward

Build Status
Scrutinizer Code Quality
Latest Stable Version
Total Downloads

SfForwardBundle is a bundle that allows you to forward server-side HTTP requests
using the Guzzle library.

INSTALLATION

To install this bundle, run the following command:

  1. $ composer require sdaoudi/sf-forward

USAGE

Enable bundle:
  1. SfForward\SfForwardBundle::class => ['all' => true],
Add the SfForward route to your routing.yml file:
  1. sf_forward:
  2. resource: '@SfForwardBundle/Controller/SfForwardController.php'
  3. type: annotation
Guzzle configuration:

For the Guzzle configuration, see the 8p/EightPointsGuzzleBundle project
documentation:

  1. # EightPoints GuzzleBundle
  2. # A full list of configuration options can be found here:
  3. # https://github.com/8p/EightPointsGuzzleBundle/blob/master/src/Resources/doc/configuration-reference.md
  4. eight_points_guzzle:
  5. clients:
  6. my_client:
  7. # Write here the host where to do requests
  8. base_url: "http://localhost:8000"
  9. # Request options: http://docs.guzzlephp.org/en/stable/request-options.html
  10. options:
  11. # timeout in seconds
  12. timeout: 30
  13. # set to false to disable throwing exceptions on an HTTP protocol errors (4xx and 5xx responses)
  14. http_errors: true
  15. # each key is the name of a header, and each value is a string or array of strings representing the
  16. # header field values.
  17. headers:
  18. User-Agent: "EightPointsGuzzleBundle/v7"
Examples:
  1. http://symfony.local//sfForwardFront/service=MyClient&routeId=_my_route_example_2174?key=value
  • service: is the key of the client configured with Guzzle.
  • routeId: is the target route, just replace the slashes (/) by underscores (_).

In order to respect Symfony naming conventions, the service passed in
parameter would be transformed into Snake Case.