Download the PHP package duellsy/pockpack without Composer
On this page you can find all versions of the php package duellsy/pockpack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download duellsy/pockpack
More information about duellsy/pockpack
Files in duellsy/pockpack
Package pockpack
Short Description Package to handle communication with GetPocket.com API neatly.
License MIT
Homepage http://duellsy.github.com/pockpack/
Informations about the package pockpack
Pocket API - PockPack docs
This package is for connecting to the Pocket API. check out their docs here
You'll need to register an app with pocket, and use the generated tokens provided in order for you to be able to connect to the API.
Installation
Pockpack is installable via composer, the details are on packagist, here.
Add the following to the require
section of your projects composer.json file:
In files that you want to use the Pockpack classes, be sure to add the namespaces you're going to use to the top of the file similar to the following, so your code can reference the classes without issue `
Authenticate
Get request token
Redirect the user to pockets auth page
Get users access token
Get users access token and username
Get reading list
Retreive reading list
This will return a full list of all active (unarchived) bookmarks, optionally you can have it also return extra information such as images. If you would prefer the result to be an array, you can send a second boolean value to the retrieve function set to true.
The options array allows you to control exactly what is returned from the API. For the full list of options, please check 'Optional Parameters' section of the pocket retrieve API (you can also see an example JSON response on this page)
Example 1: show all favorited bookmarks, complete with images
Example 2: show only unread bookmarks, complete with image
Add new bookmark
A simple example of adding a bookmark to your reading list:
The array that is sent to the add method can contain the following information:
- item_id (integer; If you are overwriting a link)
- ref_id (integer; A Twitter status id; this is used to show tweet attribution)
- tags (array; A list of tags you want to add to this bookmark)
- time (timestamp; This is automatically added by the PockpackQueue class)
- title (string; An optional title if you want to control it)
- url (string; The URL of the item)
Modify existing bookmark
The main flow to modify a bookmark is as follows
You first need to create the pockpack connection, then add something to the queue, and finally send the queue to pocket.
You can add as many items to the queue before sending, to send in bulk to keep things fast.
Archive bookmark
Re-add bookmark
Favorite bookmark
Unfavorite bookmark
Delete bookmark
Tagging Actions for bookmarks
The main flow of tagging is as follows
Add Tags
Remove Tags
Replace Tags
Clear Tags
Clear Tag does not require $tag_info
but only $item_id
Contributing
Contributions are encouraged and welcome; to keep things organised, all bugs and requests should be opened in the github issues tab for the main project, at duellsy/pockpack/issues
All pull requests should be made to the develop branch, so they can be tested before being merged into the master branch.