freedomsex / rest-machine-bundle
1.2.7
2022-12-20 22:27 UTC
Requires
- php: ~7.4.0
- symfony/flex: ^1.17|^2
- symfony/runtime: 5.4.*
- symfony/yaml: 5.4.*
Requires (Dev)
- phpunit/phpunit: ^9.5
- sensio/framework-extra-bundle: ^5.0
- symfony/config: ^5.3
- symfony/console: 5.4.*
- symfony/dependency-injection: ^5.3
- symfony/dotenv: 5.4.*
- symfony/framework-bundle: 5.4.*
- symfony/http-client: ^5.0
- symfony/http-kernel: ^5.3
- symfony/phpunit-bridge: ^6.1
- symfony/stopwatch: 5.4.*
Conflicts
- dev-master
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 0.6.12
- 0.6.11
- 0.6.10
- 0.6.9
- 0.6.8
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.1
- 0.5.0
- 0.4.13
- 0.4.12
- v0.4.11
- v0.4.10
- v0.4.9
- v0.4.8
- v0.4.7
- v0.4.6
- v0.4.5
- 0.4.4
- v0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.6
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.1
- 0.1.0
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
This package is auto-updated.
Last update: 2024-10-21 02:13:28 UTC
README
Ported from https://www.npmjs.com/package/axios-rest-api
# /config/packages/rest_machine.yaml
rest_machine:
resources:
default:
prefix: 'api'
host: ''
search:
host: '%env(API_SEARCH_HOST)%'
access:
host: '%env(API_ACCESS_HOST)%'
#/.env
API_SEARCH_HOST=http://127.0.0.1:8007
API_ACCESS_HOST=http://127.0.0.1:8001
Get Service
Public ID: rest_machine.api_resource
Class: FreedomSex\RestMachineBundle\Services\ApiResource
Usage
use FreedomSex\RestMachineBundle\Services\ApiResource;
# ...
public function __construct(
ApiResource $api
) {
$this->api = $api;
}
public function test()
{
// get `resource` Users from API service `search` with ID: 1000
// API service `search` configured for example to host `http://127.0.0.1:8007`
// Resulting request URL `http://127.0.0.1:8007/api/users/1000` with method GET
$result = $this->api->res('users', 'search')->get(['id' => '1000']);
print_r($result);
}
# ...
onlyUrl() $this->api->res('users')->onlyUrl()->load();
- не вызывает ресурс, a только генерирует URL.
Запрос вернет NULL. URL можно получить вызвав метод $this->api->lastUrl()