PHP code example of chipslays / pastly-api

1. Go to this page and download the library: Download chipslays/pastly-api 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/ */

    

chipslays / pastly-api example snippets


use Pastly\Client;

nt;
$token = '1622233044:6bCVU-8OI9fjtk3gXhZRJkzQeDGsJNKti2MuBM_n9V';

/** get paste */
$paste = $client->get('example-slug');
$paste = pastly_get('example-slug');

echo $paste->getText();

/** create paste */
$client->create($token, 'Hello, world!');
pastly_create($token, 'Hello, world!');

/** edit paste */
$client->edit($token, 'example-slug', [
    'title' => 'New Title', 
    'syntax' => 'diff',
    'text' => "this text\n-was edited\n+successful",
]);

pastly_edit($token, 'example-slug', [
    'title' => 'New Title', 
    'syntax' => 'diff',
    'text' => "this text\n-was edited\n+successful",
]);