Download the PHP package michelf/php-smartypants without Composer

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

PHP SmartyPants

PHP SmartyPants Lib 1.8.1 - 12 Dec 2016

by Michel Fortin
https://michelf.ca/

Original SmartyPants by John Gruber
https://daringfireball.net/

Introduction

This is a library package that includes the PHP SmartyPants and its sibling PHP SmartyPants Typographer with additional features.

SmartyPants is a free web typography prettifyier tool for web writers. It easily translates plain ASCII punctuation characters into "smart" typographic punctuation HTML entities.

PHP SmartyPants is a port to PHP of the original SmartyPants written in Perl by John Gruber.

SmartyPants can perform the following transformations:

SmartyPants Typographer can perform additional transformations:

This means you can write, edit, and save using plain old ASCII straight quotes, plain dashes, and plain dots, but your published posts (and final HTML output) will appear with smart quotes, em-dashes, proper ellipses, and proper no-break spaces (with Typographer).

SmartyPants does not modify characters within <pre>, <code>, <kbd>, or <script> tag blocks. Typically, these tags are used to display text where smart quotes and other "smart punctuation" would not be appropriate, such as source code or example markup.

Backslash Escapes

If you need to use literal straight quotes (or plain hyphens and periods), SmartyPants accepts the following backslash escape sequences to force non-smart punctuation. It does so by transforming the escape sequence into a decimal-encoded HTML entity:

Escape  Value  Character
------  -----  ---------
  \\    &#92;    \
  \"    &#34;    "
  \'    &#39;    '
  \.    &#46;    .
  \-    &#45;    -
  \`    &#96;    `

This is useful, for example, when you want to use straight quotes as foot and inch marks:

6\'2\" tall

translates into:

6&#39;2&#34; tall

in SmartyPants's HTML output. Which, when rendered by a web browser, looks like:

6'2" tall

Requirements

This library package requires PHP 5.3 or later.

Note: The older plugin/library hybrid package for PHP SmartyPants and PHP SmartyPants Typographer is still will work with PHP 4.0.5 and later.

Usage

This library package is meant to be used with class autoloading. For autoloading to work, your project needs have setup a PSR-0-compatible autoloader. See the included Readme.php file for a minimal autoloader setup. (If you don't want to use autoloading you can do a classic require_once to manually include the files prior use instead.)

With class autoloading in place, putting the 'Michelf' folder in your include path should be enough for this to work:

use Michelf\SmartyPants;
$html_output = SmartyPants::defaultTransform($html_input);

SmartyPants Typographer is also available the same way:

use Michelf\SmartyPantsTypographer;
$html_output = SmartyPantsTypographer::defaultTransform($html_input);

If you are using PHP SmartyPants with another text filter function that generates HTML such as Markdown, you should filter the text after the the HTML-generating filter. This is an example with PHP Markdown:

use Michelf\Markdown, Michelf\SmartyPants;
$my_html = Markdown::defaultTransform($my_text);
$my_html = SmartyPants::defaultTransform($my_html);

To learn more about configuration options, see the full list of configuration variables.

Usage Without an Autoloader

If you cannot use class autoloading, you can still use include or require to access the parser. To load the Michelf\SmartyPants parser, do it this way:

require_once 'Michelf/SmartyPants.inc.php';

Or, if you need the Michelf\SmartyPantsTypographer parser:

require_once 'Michelf/SmartyPantsTypographer.inc.php';

While the plain .php files depend on autoloading to work correctly, using the .inc.php files instead will eagerly load the dependencies that would be loaded on demand if you were using autoloading.

Algorithmic Shortcomings

One situation in which quotes will get curled the wrong way is when apostrophes are used at the start of leading contractions. For example:

'Twas the night before Christmas.

In the case above, SmartyPants will turn the apostrophe into an opening single-quote, when in fact it should be a closing one. I don't think this problem can be solved in the general case -- every word processor I've tried gets this wrong as well. In such cases, it's best to use the proper HTML entity for closing single-quotes (&#8217; or &rsquo;) by hand.

Bugs

To file bug reports or feature requests (other than topics listed in the Caveats section above) please send email to:

[email protected]

If the bug involves quotes being curled the wrong way, please send example text to illustrate.

Version History

PHP SmartyPants Lib 1.8.1 (12 Dec 2016)

PHP SmartyPants Lib 1.8.0 (13 Nov 2016)

PHP SmartyPants Lib 1.7.1 (16 Oct 2016)

PHP SmartyPants Lib 1.7.0 (15 Oct 2016)

PHP SmartyPants Lib 1.6.0 (10 Oct 2016)

This is the first release of PHP SmartyPants Lib. This package requires PHP version 5.3 or later and is designed to work with PSR-0 autoloading and, optionally with Composer. Here is a list of the changes since PHP SmartyPants 1.5.1f:


All versions of php-smartypants with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
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 michelf/php-smartypants contains the following files

Loading the files please wait ....