PHP code example of ademes / core

1. Go to this page and download the library: Download ademes/core library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ademes / core example snippets


$user = $app['userClient']->getLoggedInUser($authResponse->getAccessToken());
if ($user) {
    Session::put('data.user', $user);
}

$query = $this->http->get($_ENV['API_VERSION'].'/companies', [
    'query' => [
        'access_token' => Session::get('AuthToken')->getAccessToken()
    ]
]);

$data = [
    'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],
    'body' => [
        'name' => Input::get('name'),
        'description' => Input::get('description'),
        'url' => Input::get('url'),
        'photo' => fopen($path, 'r'),
        'access_token' => Session::get('AuthToken')->getAccessToken()
    ]
];
$response = $this->http->post($_ENV['API_VERSION'] . '/companies', $data);

$body = ['access_token'=>Session::get('AuthToken')->getAccessToken()];
$response = $this->http->delete($_ENV['API_VERSION'] . '/companies/' . $id, ['body'=>$body]);

$data = [
    'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],
    'body' => [
        '_method' => 'PUT',
        'name' => Input::get('name'),
        'description' => Input::get('description'),
        'url' => Input::get('url'),
        'access_token' => Session::get('AuthToken')->getAccessToken()
    ]
];
$response = $this->http->post($_ENV['API_VERSION'] . '/companies/'.$id, $data);