ad3n / client-platform
The Web Api Client Framework
1.8.0
2017-10-11 01:17 UTC
Requires
- php: >=5.5.9
- guzzlehttp/guzzle: ~6.2
- pimple/pimple: ~3.0
- stack/builder: ^1.0
- symfony/cache: ~3.0
- symfony/config: ~3.0
- symfony/event-dispatcher: ~3.0
- symfony/finder: ~3.0
- symfony/http-foundation: ~3.0
- symfony/http-kernel: ~3.0
- symfony/routing: ~3.0
- symfony/yaml: ~3.0
- twig/twig: ~1.0
- dev-master
- 1.8.0
- 1.7.19
- 1.7.18
- 1.7.17
- 1.7.16
- 1.7.15
- 1.7.14
- 1.7.13
- 1.7.12
- 1.7.11
- 1.7.10
- 1.7.9
- 1.7.8
- 1.7.7
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.10
- 1.6.9
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2
- 1.1
- 1.0
- 0.25
- 0.24
- 0.23
- 0.22
- 0.21
- 0.20
- 0.19
- 0.18
- 0.17
- 0.16
- 0.15
- 0.14
- 0.13
- 0.11
- 0.10
- 0.9
- 0.8
- 0.7
- 0.6
- 0.5
- 0.4
- 0.3
- 0.2
- 0.1
This package is auto-updated.
Last update: 2024-11-20 19:52:03 UTC
README
What
Client platform is simple framework that aim to simplify Frontend Developer that working with API Platform
Installation
Add composer.json
{ "require": { "ad3n/client-platform": "~1.0" }, "autoload": { "psr-4": { "App\\": "src/" } } }
Create configuration file config.yml
app: base_url: 'abc' routes: - { path: '/{a}/{b}', controller: 'App:HomeController@index', methods: ['GET'] } template: path: '/var/views' cache_dir: '/var/cache' # Aktifkan jika ingin mencoba kerja event listenernya # event_listeners: # - { event: 'kernel.request', class: 'App\EventListener\FilterRequestListener', method: 'filter' }
Create application class Application.php
<?php namespace App; use Ihsan\Client\Platform\Bootstrap; use Psr\Cache\CacheItemPoolInterface; class Application extends Bootstrap { /** * @param string $configDir * @param CacheItemPoolInterface|null $cachePool * @param array $values */ public function __construct($configDir, CacheItemPoolInterface $cachePool = null, array $values = array()) { parent::__construct($cachePool, $values); $this->boot($configDir); } /** * @return string */ protected function projectDir() { return __DIR__.'/..'; } }
Create Front Controller aka index.php
<?php require __DIR__.'/../vendor/autoload.php'; use App\Application; use Symfony\Component\HttpFoundation\Request; $configDir = __DIR__.'/../app/config'; $request = Request::createFromGlobals(); $app = new Application(); $app->boot($configDir); $app->handle($request);
Create Controller HomeController.php
<?php namespace App\Controller; use Ihsan\Client\Platform\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; class HomeController extends AbstractController { public function indexAction() { //$this->get('url', $args); //$this->post('url', $args); //$this->put('url', $args); //$this->delete('url', $args); //$this->client //Client is instance of \Ihsan\Client\Platform\Api\ClientInterface //$this->renderResponse('view_name', $viewArgs); return new Response('Hello World!.'); } }
For more information about controller, please read Ihsan\Client\Platform\Controller\AbstractController.php
Configuration
For more information about configuration, please read Ihsan\Client\Platform\Configuration\Configuration.php#L78-L166