PHPackages                             duellsy/pockpack - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. duellsy/pockpack

ActiveLibrary[API Development](/categories/api)

duellsy/pockpack
================

Package to handle communication with GetPocket.com API neatly.

v2.5.0(11y ago)233763[1 issues](https://github.com/duellsy/pockpack/issues)MITPHPPHP &gt;=5.3.0

Since Jan 24Pushed 11y ago1 watchersCompare

[ Source](https://github.com/duellsy/pockpack)[ Packagist](https://packagist.org/packages/duellsy/pockpack)[ Docs](http://duellsy.github.com/pockpack/)[ RSS](/packages/duellsy-pockpack/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (5)Dependencies (2)Versions (14)Used By (0)

Pocket API - PockPack docs
==========================

[](#pocket-api---pockpack-docs)

This package is for connecting to the Pocket API. [check out their docs here](http://getpocket.com/developer/)

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.

[![Build Status](https://camo.githubusercontent.com/48013fa46da9338915e2202b515d3c3624e0bff0c792760fffb4eb1376298a6b/68747470733a2f2f7472617669732d63692e6f72672f6475656c6c73792f706f636b7061636b2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/duellsy/pockpack)

Installation
------------

[](#installation)

Pockpack is installable via [composer](http://getcomposer.org/doc/00-intro.md), the details are on [packagist, here.](https://packagist.org/packages/duellsy/pockpack)

Add the following to the `require` section of your projects composer.json file:

```
"duellsy/pockpack": "2.*"

```

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

```
use Duellsy\Pockpack\Pockpack;
use Duellsy\Pockpack\PockpackAuth;
use Duellsy\Pockpack\PockpackQueue;

```

Authenticate
------------

[](#authenticate)

### Get request token

[](#get-request-token)

```
$pockpath_auth = new PockpackAuth();
$request_token = $pockpath_auth->connect($consumer_key);

```

### Redirect the user to pockets auth page

[](#redirect-the-user-to-pockets-auth-page)

```
https://getpocket.com/auth/authorize?request_token=YOUR_REQUEST_TOKEN&redirect_uri=YOUR_REDIRECT_URI

```

### Get users access token

[](#get-users-access-token)

```
$pockpack = new PockpackAuth();
$access_token = $pockpack->receiveToken($consumer_key, $request_token);

```

### Get users access token and username

[](#get-users-access-token-and-username)

```
$pockpack = new PockpackAuth();
$data = $pockpack->receiveTokenAndUsername($consumer_key, $request_token);
$access_token = $data['access_token'];
$username = $data['username'];

```

Get reading list
----------------

[](#get-reading-list)

### Retreive 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.

```
$pockpack = new Pockpack($consumer_key, $access_token);
$as_array = true; // false will return JSON, true will return an array
$list = $pockpack->retrieve($options[, $as_array]); // the second parameter is optional, defaults to false

```

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](http://getpocket.com/developer/docs/v3/retrieve) (you can also see an example JSON response on this page)

Example 1: show all favorited bookmarks, complete with images

```
$options = array(
    'state'         => 'all',
    'favorite'      => 1,
    'detailType'    => 'complete'
);

```

Example 2: show only unread bookmarks, complete with image

```
$options = array(
    'state'         => 'favorite',
    'detailType'    => 'complete'
);

```

Add new bookmark
----------------

[](#add-new-bookmark)

A simple example of adding a bookmark to your reading list:

```
$link_info = array(
    'url'       => 'http://example.com'
);

$pockpack = new Pockpack($pocket_consumer_key, $pocket_access_token);
$pockpack_q = new PockpackQueue();

$pockpack_q->add($link_info);
$pockpack->send($pockpack_q);

```

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
------------------------

[](#modify-existing-bookmark)

The main flow to modify a bookmark is as follows

```
$pockpack = new Pockpack($pocket_consumer_key, $pocket_access_token);
$pockpack_q = new PockpackQueue();

$pockpack_q->favorite($item_id);

$pockpack->send($pockpack_q);

```

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

[](#archive-bookmark)

```
$pockpack_q->archive($item_id);

```

### Re-add bookmark

[](#re-add-bookmark)

```
$pockpack_q->readd($item_id);

```

### Favorite bookmark

[](#favorite-bookmark)

```
$pockpack_q->favorite($item_id);

```

### Unfavorite bookmark

[](#unfavorite-bookmark)

```
$pockpack_q->unfavorite($item_id);

```

### Delete bookmark

[](#delete-bookmark)

```
$pockpack_q->delete($item_id);

```

Tagging Actions for bookmarks
-----------------------------

[](#tagging-actions-for-bookmarks)

The main flow of tagging is as follows

```
$pockpack = new Pockpack($pocket_consumer_key, $pocket_access_token);
$pockpack_q = new PockpackQueue();

$tags = array("sampleTag1","sampleTag2");
$tag_info = array(
    'item_id'     => $item_id,
    'tags'        => $tags

);

$pockpack_q->tags_add($tag_info);

$pockpack->send($pockpack_q);

```

### Add Tags

[](#add-tags)

```
$pockpack_q->tags_add($tag_info);

```

### Remove Tags

[](#remove-tags)

```
$pockpack_q->tags_remove($tag_info);

```

### Replace Tags

[](#replace-tags)

```
$pockpack_q->tags_replace($tag_info);

```

### Clear Tags

[](#clear-tags)

Clear Tag does not require `$tag_info` but only `$item_id`

```
$pockpack_q->tags_clear($item_id);

```

Contributing
------------

[](#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](https://github.com/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.

[![Bitdeli Badge](https://camo.githubusercontent.com/c5ce5eb9ebc0c60eff3b8b66ab0df3b6f11149e49f95a50d6c931b62c5c7c387/68747470733a2f2f64327765637a68766c38323376302e636c6f756466726f6e742e6e65742f6475656c6c73792f706f636b7061636b2f7472656e642e706e67)](https://bitdeli.com/free "Bitdeli Badge")

###  Health Score

33

—

LowBetter than 73% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 70.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~51 days

Recently: every ~67 days

Total

12

Last Release

4318d ago

Major Versions

1.1.1 → 2.0.02013-01-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/37659155ef5a56509fda5ddba837c0b6a13cc21d09146551c2646d87779eb15e?d=identicon)[duellsy](/maintainers/duellsy)

---

Top Contributors

[![duellsy](https://avatars.githubusercontent.com/u/330539?v=4)](https://github.com/duellsy "duellsy (54 commits)")[![acairns](https://avatars.githubusercontent.com/u/705212?v=4)](https://github.com/acairns "acairns (15 commits)")[![dietervds](https://avatars.githubusercontent.com/u/1225429?v=4)](https://github.com/dietervds "dietervds (3 commits)")[![jwpage](https://avatars.githubusercontent.com/u/52687?v=4)](https://github.com/jwpage "jwpage (3 commits)")[![dpcat237](https://avatars.githubusercontent.com/u/388031?v=4)](https://github.com/dpcat237 "dpcat237 (1 commits)")[![Gleek](https://avatars.githubusercontent.com/u/3756804?v=4)](https://github.com/Gleek "Gleek (1 commits)")

---

Tags

pocketgetpocketget pocketread it laterreaditlaterpockpack

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/duellsy-pockpack/health.svg)

```
[![Health](https://phpackages.com/badges/duellsy-pockpack/health.svg)](https://phpackages.com/packages/duellsy-pockpack)
```

###  Alternatives

[rackspace/php-opencloud

PHP SDK for Rackspace/OpenStack APIs

4565.9M38](/packages/rackspace-php-opencloud)[cdaguerre/php-trello-api

Trello API v2 client

256674.5k3](/packages/cdaguerre-php-trello-api)[dchesterton/marketo-rest-api

A PHP client for the Marketo.com REST API

39844.3k1](/packages/dchesterton-marketo-rest-api)[carlosio/geckoboard

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

41172.6k](/packages/carlosio-geckoboard)[teepluss/api

Laravel 4 Internal Request (HMVC)

7034.1k](/packages/teepluss-api)[jlinn/mandrill-api-php

A PHP client library for Mandrill's REST API

24119.4k](/packages/jlinn-mandrill-api-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
