README

Features

Normal pastebin features: syntax highlighting by language, short URLs, ability
to mark pastes as "private" (meaning they do not show up in listings).

Ability to specify "markdown" as the language; this will pass the paste
through the markdown parser to generate markup.

Ability to specify "sections" of code, and thus paste multiple "files" in the
same paste. Any line starting with "##" signifies a section. The section will
contain any text following "##" as the title:

test.txt

This is the first section.

test2.txt

This is the second section.

Additionally, if you place a language name in brackets, that language will be
used for syntax highlighting for that section:

test.js [javascript]

{
"text": "highlighted as javascript"
}

test.php [php]

echo "This is highlighted as PHP";

Developers familiar with pastie.org will find the above syntax familiar.

An API for listing pastes, retrieving individual paste details, and submitting
pastes. The paste retrieval portion of the API does not require authorization,
but submitting a paste requires an authorization token. (See the section
titled "API" below for details.

CAPTCHA setup

By default, the "Dumb" CAPTCHA adapter is used. You can setup an alternate one
by providing either global or local configuration under the "phly_paste" key's
"captcha" subkey. Configuration is consistent with Zend\Captcha\Factory:

You can disable CAPTCHA for authenticated users. To do this, you need to define
an alias named PhlyPaste\AuthService that points to a service returning a
Zend\Authentication\AuthenticationService instance. Once enabled, CAPTCHAs
will no longer be displayed for currently authenticated users.

API

An API is also enabled for this module. By default, it goes to the route
described by the path '/paste/api/paste'. The API is JSON only, and expects that
the Accept header matches against the media type 'application/hal+json' (it also
allows 'application/json', but 'application/hal+json' will always be returned).

The following operations are available:

GET /paste/api/paste[?page=X]

Retrieves a single page of a list of pastes. The payload looks like the
following:

Authorization Tokens for Submitting Pastes

As you may have noticed in the previous example, the POST operation requires an
"X-PhlyPaste-Token" header. Tokens are verified against the
PhlyPaste\TokenService service, which is simply a
PhlyPaste\Model\TokenServiceInterface implementation. By default, a single
implementation is provided, PhlyPaste\Model\ArrayTokenService. This
implementation expects that the configuration includes tokens:

returnarray('phly_paste'=>array('tokens'=>array('yourtoken', ), ),);

If you use this approach, make sure that tokens are defined in .local.php
files that are stored outside your repository.

Alternately, you may create your own implementation of the
TokenServiceInterface that can be used to verify tokens.