// Creating a new Symfony project symfony new myproject // Creating a new controller php bin/console make:controller UserController // Routing a URL to a controller method /** * @Route("/user", name="user_list") */ public function userList() { // Controller logic here }
// Creating a new Laravel project composer create-project --prefer-dist laravel/laravel myproject // Creating a new controller php artisan make:controller UserController // Routing a URL to a controller method Route::get('/user', 'UserController@userList');
// Installing Guzzle using composer composer require guzzlehttp/guzzle // Sending a GET request use GuzzleHttp\Client; $client = new Client(); $response = $client->get('https://example.com'); $body = $response->getBody()->getContents(); // Sending a POST request with parameters $response = $client->post('https://example.com/api', [ 'form_params' => [ 'param1' => 'value1', 'param2' => 'value2' ] ]);