Download the PHP package freepius/php-richtext without Composer

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

php-richtext

This package provides :

Markdown(Extra) and SmartyPants(Typographer) packages come from Michel Fortin. Thanks to him for its great work!

php-richtext works with PHP 5.3 or later.

Installation

The recommended way to install php-richtext is through Composer. Just create a composer.json file and run the php composer.phar install command to install it:

{
    "require": {
        "freepius/php-richtext": "~1.0"
    }
}

Usage

Use from an instance of the Richtext class:

<?php

require_once __DIR__.'/../vendor/autoload.php';

$richtext = new Freepius\Richtext($config);

echo $richtext->transform($text);

echo $richtext->markdown($text);

echo $richtext->smartypants($text);

Use as services of a Pimple DI Container:

<?php

require_once __DIR__.'/../vendor/autoload.php';

$c = new Pimple\Container();

$c->register(new Freepius\Pimple\Provider\RichtextServiceProvider(), array(
    'richtext.config' => array(/*config here*/),
));

echo $c['richtext']->transform($text);

echo $c['richtext']->markdown($text);

echo $c['richtext']->smartypants($text);

Since Silex uses internally the Pimple DI Container, you can use php-richtext with Silex:

<?php

require_once __DIR__.'/../vendor/autoload.php';

use Freepius\Pimple\Provider\RichtextServiceProvider;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

$app = new Application();

$app->register(new RichtextServiceProvider(), array(
    'richtext.config' => array(/*config here*/),
));

$app->post('/blog/render-text', function (Application $app, Request $request) {
    return $app['richtext']->transform($request->get('text'));
});

$app->run();

If Twig is installed, you can also use the richtext filters in your Twig templates:

<?php

require_once __DIR__.'/../vendor/autoload.php';

/* From there, Twig is assumed to be loaded */

$richtext = new Freepius\Richtext($config);

$twig->addExtension(
    new Freepius\Twig\Extension\RichtextTwigExtension($richtext)
);
{{ 'Here a <<markdown-extra>> and/or ,,smartypants-typo`` text.' | richtext }}

{{ 'Here a <<markdown-extra>> and/or ,,smartypants-typo`` text.' | markdown }}

{{ 'Here a <<markdown-extra>> and/or ,,smartypants-typo`` text.' | smartypants }}

Note for Silex: If you use Twig through Silex, first register the TwigServiceProvider, then register the RichtextServiceProvider. This one will add automatically the twig extension!

Configuration

The constructor of Richtext class accepts the following configuration parameters (as an associative array):

Note: If locale is defined and smartypants.attr is null, smartypants.attr is guessed according to locale. Presently, only 'en' (de facto) and 'fr' are handled.

Tests

To run the test suite, you need Composer:

$ php composer.phar install --dev
$ vendor/bin/phpunit

License

php-richtext is licensed under the CC0 license.


All versions of php-richtext with dependencies

PHP Build Version
Package Version
Requires michelf/php-markdown Version 1.4.*@dev
michelf/php-smartypants Version 1.6.*@dev
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 freepius/php-richtext contains the following files

Loading the files please wait ....