Download the PHP package scottybo/bufferapp without Composer

On this page you can find all versions of the php package scottybo/bufferapp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bufferapp

bufferapp

Composer ready version of https://github.com/thewebguy/bufferapp-php

Simple PHP library for the amazing buffer at https://buffer.com

Why?

There wasn't one listed on Buffer's website and a quick Google search didn't turn one up. For most use cases Buffer's plugins will work just fine, but for those of you looking to pump lots of info into buffer via PHP this may help!

Using this library

  1. Include the file
    • Make sure you've got buffer.php included
  2. Create a new Buffer app
    • You'll need to register an app with buffer before you can begin
    • Initialize like this $buffer = new BufferApp($client_id, $client_secret, $callback_url); The callback_url needs to be the exact same as the app you registered
  3. Start adding buffers!
    • Once you're in you really only need to check $buffer->ok to see if you can perform actions, and then $buffer->go($endpoint, $data) to get going!
Image Attachments

The Buffer API documentation has a list of the media parameters for creating an update.

Their example here includes media[link], media[title] & media[description].

To get the desired result you will need to use media[picture] and media[thumbnail].

Example

First thing's first: start a session and require buffer.php. We're going to be storing the access_token in the session for now.

    session_start();
    require('buffer.php');

Set this thing up with your credentials and your callback URL. Remember: callback_url must match what you've got in Buffer exactly!

    $client_id = '';
    $client_secret = '';
    $callback_url = 'http://127.0.0.1/callback';

Set up the new buffer client. This is a super simple action that does a few things under the hood. If $_GET['code'] is set on this page it assumes it came from Buffer and will attempt to trade that code for an access_token. If there is an access_token in the session it will be loaded in.

    $buffer = new BufferApp($client_id, $client_secret, $callback_url);

Once we've got an access_token set the $buffer->ok property will read true. It is false by default. Now that we've received access we are free to run queries against Buffer endpoints! Below we pull the list of profiles associated with the logged in buffer user and submit a test update to each one.

    if (!$buffer->ok) {
        echo '<a href="' . $buffer->get_login_url() . '">Connect to Buffer!</a>';
    } else {
        //this pulls all of the logged in user's profiles
        $profiles = $buffer->go('/profiles');

        if (is_array($profiles)) {
            foreach ($profiles as $profile) {
                //this creates a status on each one
                $buffer->go('/updates/create', array('text' => 'My first status update from bufferapp-php worked!', 'profile_ids[]' => $profile->id));
            }
        }
    }

Storage

Right now this baby just stores the access_token in $_SESSION['oauth']['buffer']['access_token']. If you are doing something serious with this you should probably rewrite the store_access_token() and retrieve_access_token() methods.

Realistically these methods should be replaced with some sort of abstraction -- pull requests are welcome!

License

Do whatever you like with this. Feel free (but not obligated) to drop me a line if it helps!


All versions of bufferapp with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package scottybo/bufferapp contains the following files

Loading the files please wait ....