Download the PHP package nick-jones/php-ucd without Composer

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

PHP UCD

Travis Scrutinizer Minimum PHP Version

This project aims to present a PHP interface into the Unicode Character Database (UCD). It provides a means to lookup, filter, and interrogate the metadata & properties of unicode characters.

Installation

You can install this library via composer:

composer require nick-jones/php-ucd

Usage

The primary interface to utilise is UCD\Database. This provides a number of methods to interrogate "codepoint assigned" entities (i.e. Character, NonCharacter, and Surrogate instances) that reside within the UCD:

The UCD\Unicode\Character\Collection class, returned by a number of methods, provides methods for filtering, traversal, codepoint extractions, amongst other things.

It is likely that you will want to leverage the default Character\Repository for resolution of characters, etc, in which case, calling UCD\Collection::fromDisk() will give you an instance backed by FileRepository. You can, of course, leverage a different Character\Repository implementation, if you so wish, by providing it to the constructor of UCD\Database.

Because this project makes good use of generators, the memory footprint of interrogating the dataset is fairly nominal.

Caveats

As of Unicode 8.0 there are > 260,000 items assigned codepoints. Reading, filtering and traversing all of these will take a few seconds. As such, if your intention is to identify items by filtering rules, you would be well advised to cache the output in some suitable form (e.g. build a regex, or PHP array of codepoints) which can then be interrogated, rather than always returning to filter and traverse the database. If your intention is to perform lookup by codepoint, then it is no problem to call into this library when and as required, as this is an efficient operation.

Examples

Manual Filtering + Traversal

Say you wish to dump all characters that hold a numeric property and reside outside of the Basic Latin (ASCII) block. You could simply leverage the Collection::filterWith(callable $filter) method to interrogate the properties of each Character instance. You could then perhaps dump their latin equivalent representation by calling ::getNumber() on the Numericity property. For example:

Codepoint Lookup

Locating an individual character by its codepoint value is trivial:

It is just as trivial to interrogate multiple codepoints. For example, you could print the name of every codepoint residing within a string:

Factory methods are available on the Codepoint and Codepoint\Collection classes to construct instances based on UTF-8, UTF-16BE, UTF-16LE, UTF-32BE and UTF-32LE encoded character(s).

Regex Building

The library provides a means to build regular expression characters classes based codepoints that have been extracted or aggregated from a collection of characters. For example, if you wanted to produce a regular expression that matched numeric flavour bengali characters, then you could use something along the lines of:

Map Building

This library can be used for building maps for various purposes. One such example is building a lowercase → uppercase character map. This is relatively simple to achieve; interrogate the properties of each character to check whether a mapping to a different character exists - if one does, print it out in PHP syntax:

This can then be leveraged as follow:

Executable

The primary intention of this project is to act as a library, however a small utility command is available for testing and database generation/manipulation purposes. bin/ucd search <codepoint> will dump character information, and bin/ucd repository-transfer <from> <to> will transfer characters from one repository implementation to another. Please run bin/ucd for more detailed help.

Properties

The intention of the most interesting of the available character properties, as described in Unicode Standard Annex #44, Unicode Character Database - Properties, available for interrogation. There are, however, a good quantity of them, so this remains work in progress. The following are currently covered:

Tests

PhpSpec class specifications and PHPUnit backed integration tests are provided. The easiest way to run them is via the Makefile; simply run make test.


All versions of php-ucd with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
ext-iconv Version *
ext-zlib Version *
psr/log Version ^1.0
judev/php-intervaltree Version ^2.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 nick-jones/php-ucd contains the following files

Loading the files please wait ....