Download the PHP package scribe/pygments-bundle without Composer

On this page you can find all versions of the php package scribe/pygments-bundle. 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 pygments-bundle

VarspoolPygmentsBundle

Provides (X)HTML rendering of Markdown similar to GFM (Github flavored markdown), including syntax-highted fenced code blocks. Code coloring is provided by the Python Pygments library (interfaces with pygmentize using proc_open for now).

VarspoolPygmentsBundle doesn't reinvent the wheel: it uses the Sundown support in KwattroMarkdownBundle to do the initial Markdown rendering.

Installation

Install the Sundown PHP extension

The Sundown extension is available via PECL in beta state, so installing it should be something like:

You'll be able to tell you're successful when the Sundown extension is shown in the output of php\_info():

Install pygments

This is usually available via your package manager, as the python-pygments package or similar.

The key thing, however, is just that you have the pygmentize script available to execute. It's usually at /usr/bin/pygmentize, but if not, you can configure its location (see app/config.yml below).

Composer

Add varspool/pygments-bundle to your requires field. Then install/update your dependencies.

app/AppKernel.php

Register the KwattroMarkdownBundle and VarspoolPygmentsBundle:

app/config.yml

Next, configure the default Markdown renderer for the kwattro_markdown service, so that it'll stop complaining.

You can optionally configure where to find the pygmentize script. The default is /usr/bin/pygmentize:

You can also specify lexer arguments, that'll be passed to Pygmentize. See the documentation for a list:

Despite its name, this option can also contain formatter arguments, such as linenos.

Usage

Services

kwattro_markdown

KwattroMarkdownBundle usually provides the kwattro_markdown service. This won't change when you set up VarspoolPygmentsBundle: the service will continue to provide a Markdown rendering without syntax highlighting. This service is usually a Kwattro\MarkdownBundle\Markdown\KwattroMarkdown object.

varspool_markdown

Once you've installed VarspoolPygmentsBundle, you'll have a second service available: vaspool_markdown. This service will extend Kwattro\MarkdownBundle\Markdown\KwattroMarkdown, so you should just be able to swap it in as a replacement quite easily. It'll colorize fenced code blocks in the markdown. This service is usually a Varspool\PygmentsBundle\Markdown\KwattroMarkdown object.

varspool_pygments

This service is the Sundown renderer instance responsible for coloring the output. It's usually an instance of Varspool\PygmentsBundle\Sundown\Render\ColorXHTML.

Stylesheets

The Pygments renderer marks up parts of the output with div tags and classes. You'll then need to assign stlying to these tags.

SCSS/Compass

If you're already using Compass or SASS, there's an example Pygments stylesheet in Resources/public/css/_pygments.scss. The default implementation uses the Solarized color scheme. You should be able to @import this stylesheet from one of your own.

Dynamic Styles

Pygments can provide one of several stylesheets to automatically color the output. A controller is provided that will output styles by calling pygmentize -S <style>. To use the controller, reference it from your routing:

Then include a CSS file in your page via the URL /pygments/<pygments_formatter>/<pygments_style>.css. (e.g. /pygments/html/friendly.css).

Alternatively, you can get the styles as a string from the varspool_pygments service:


All versions of pygments-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/framework-bundle Version ~2.5
scribe/markdown-bundle Version ~0.1
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 scribe/pygments-bundle contains the following files

Loading the files please wait ...