Home > Download >  Library download

  • <?php error_reporting(E_ALL | E_STRICT); // Ensure that composer has installed all dependencies if (!file_exists(dirname(__DIR__) . DIRECTORY_SEPARATOR . '/vendor/autoload.php')) {     die("Dependencies must be installed using composer:\n\nphp composer.phar install --dev\n\n"         . "See http://getcomposer.org for help with installing composer\n"); } // Include the Composer autoloader $loader = include realpath(dirname(__FILE__) . '/../vendor/autoload.php'); provides large number operation classes in PHP. Some classes are used for high-precision calculations. The BigInteger class is a processing class for large integers, and the BigDecimal class is a processing class for large and small numbers. Next we introduce the BigDecimal class: The implementation of BigDecimal uses BigInteger. The difference is that BigDecimal adds the concept of decimals. General float and Double data can only be used for scientific calculations or engineering calculations. Since commercial calculations require relatively high numerical precision, the java.math.BigDecimal class is used, which supports any precision determination. Points, which can be used to accurately calculate monetary values.

    Other libraries10462017-12-13
  • <?php require_once '../src/MischiefCollective/ColorJizz/Autoloader.php'; MischiefCollective\ColorJizz\Autoloader::register(); use MischiefCollective\ColorJizz\Formats\Hex; echo Hex::create(0x00096A)->toCIELCh()->toHex()->hue(230);This class is a PHP class for converting or processing colors. It can convert any color into its inverse color. Share it with everyone for your reference. This php code can change a color into the opposite color coding, such as: white becomes black, blue becomes yellow

    Other libraries10562017-12-13
  • <?php /*  * Copyright (C) 2016 Nicolas Grekas - p@tchwork.com  *  * This library is free software; you can redistribute it and/or modify it  * under the terms of the (at your option):  * Apache License v2.0 (http://apache.org/licenses/LICENSE-2.0.txt), or  * GNU General Public License v2.0 (http://gnu.org/licenses/gpl-2.0.txt).  */ /**  * Normalizer plugs Patchwork\PHP\Shim\Normalizer as a PHP implementation  * of intl's Normalizer when the intl extension in not enabled.  */ class Normalizer extends Patchwork\PHP\Shim\Normalizer { }UTF-8 (8-bit Unicode Transformation Format) is a variable-length character encoding for Unicode, also known as Universal Code. Created by Ken Thompson in 1992. It is now standardized as RFC 3629. UTF-8 encodes Unicode characters using 1 to 6 bytes. Used on web pages to display simplified, traditional, Chinese and other languages ​​in a unified manner

    Other libraries10502017-12-13
  • 测量单位:用于表示与其相比较的同 <?php namespace PhpUnitsOfMeasureTest; use PhpUnitsOfMeasure\UnitOfMeasure; class UnitOfMeasureTest extends \PHPUnit_Framework_TestCase {     /**      * @covers \PhpUnitsOfMeasure\UnitOfMeasure::__construct      * @covers \PhpUnitsOfMeasure\UnitOfMeasure::getName      */     public function testGetName()     {         $uom = new UnitOfMeasure(             'quatloos',             function ($valueInNativeUnit) {                 return $valueInNativeUnit;             },             function ($valueInThisUnit) {                 return $valueInThisUnit;             }         );         $this->assertEquals('quatloos', $uom->getName());     }Conventional definition of species size and specific amounts used. Chinese name measurement unit definition Definition and specific quantity unit symbol m Also name measurement unit Definition: Conventional definition and symbol used to express the same type of quantity compared with it The specific amount used. ①The units of measurement are given names and symbols by convention. For example, the unit name of length is meter and the unit symbol is m. ②Quantities of the same dimension Even if these quantities are not the same quantity, their units can have the same name and symbol. For example, the units of work, heat, and energy are Joules (J). ③The unit of measurement is also called the unit of measurement in our country.

    Other libraries11252017-12-13
  • <?php namespace OAuth\Common; /**  * @author ieter Hordijk <info@pieterhordijk.com>  */ class AutoLoader {     /**      * @var string The namespace prefix for this instance.      */     protected $namespace = '';     /**      * @var string The filesystem prefix to use for this instance      */     protected $path = '';     /**      * Build the instance of the autoloader      *      * @param string $namespace The prefixed namespace this instance will load      * @param string $path      The filesystem path to the root of the namespace      */     public function __construct($namespace, $path)     {         $this->namespace = ltrim($namespace, '\');         $this->path      = rtrim($path, '/\') . DIRECTORY_SEPARATOR;     }OAUTH protocol provides a secure, open and simple standard for user resource authorization. At the same time, any third party can use the OAUTH authentication service, and any service provider can implement its own OAUTH authentication service, so OAUTH is open. The industry provides multiple implementations of OAUTH, such as PHP, JavaScript, Java, Ruby and other language development kits, which greatly saves programmers' time, so OAUTH is simple. Many Internet services such as Open API, and many large companies such as Google, Yahoo, Microsoft, etc. provide OAUTH authentication services. These are enough to show that the OAUTH standard has gradually become the standard for open resource authorization.

    Other libraries11352017-12-13
  • The OAUTH protocol provides a secure, open and simple standard for the authorization of user resources. At the same time, any third party can use the OAUTH authentication service, and any service provider can implement its own OAUTH authentication service, so OAUTH is open. The industry provides multiple implementations of OAUTH, such as PHP, JavaScript, Java, Ruby and other language development kits, which greatly saves programmers' time, so OAUTH is simple. Many Internet services such as Open API, and many large companies such as Google, Yahoo, Microsoft, etc. provide OAUTH authentication services. These are enough to show that the OAUTH standard has gradually become the standard for open resource authorization.

    Other libraries9192017-12-13
  • <?php namespace Dflydev\Hawk\Client; use Dflydev\Hawk\Credentials\Credentials; use Dflydev\Hawk\Nonce\NonceProviderInterface; use Dflydev\Hawk\Time\TimeProviderInterface; class ClientTest extends \PHPUnit_Framework_TestCase {     /**      * @test      */     public function shouldCreateBewit()     {         $client = ClientBuilder::create()->build();         $tentTestVectorsCredentials = new Credentials(             'HX9QcbD-r3ItFEnRcAuOSg',             'sha256',             'exqbZWtykFZIh2D7cXi9dA'         );         $this->assertEquals(             'ZXhxYlpXdHlrRlpJaDJEN2NYaTlkQVwxMzY4OTk2ODAwXE8wbWhwcmdvWHFGNDhEbHc1RldBV3ZWUUlwZ0dZc3FzWDc2dHBvNkt5cUk9XA',             $client->createBewit(                 $tentTestVectorsCredentials,                 'https://example.com/posts',                 0,                 array(                     'timestamp' => 1368996800,                 )             )         );     } }Hypertext Transfer Protocol (HTTP, HyperText Transfer Protocol) is the most widely used network protocol on the Internet. All WWW files must comply with this standard. HTTP was originally designed to provide a method for publishing and receiving HTML pages. In 1960, American Ted Nelson conceived a method of processing text information through computers and called it hypertext. This became the foundation for the development of the standard architecture of the HTTP hypertext transfer protocol. Ted Nelson organized and coordinated the joint research between the World Wide Web Consortium and the Internet Engineering Task Force, and finally released a series of RFCs, among which the famous RFC 2616 defined HTTP 1.1.

    Other libraries16112017-12-13
  • <?php include(dirname(__FILE__).'/../lib/emoji.php'); header('Content-type: text/plain; charset=UTF-8'); $GLOBALS['failures'] = 0; $test_unified= "Hello ".utf8_bytes(0x2649); $test_iphone= "Hello ".utf8_bytes(0xE240); $test_docomo= "Hello ".utf8_bytes(0xE647); $test_kddi= "Hello ".utf8_bytes(0xE490); $test_google= "Hello ".utf8_bytes(0xFE02C); $test_html= "Hello ".test_html(2649); is(emoji_docomo_to_unified($test_docomo),$test_unified, "DoCoMo -> Unified"); is(emoji_kddi_to_unified($test_kddi),$test_unified, "KDDI -> Unified"); is(emoji_softbank_to_unified($test_iphone),$test_unified, "Softbank -> Unified"); is(emoji_google_to_unified($test_google),$test_unified, "Google -> Unified"); echo "#------------------\nSometimes we get an expression string and want it to display the corresponding expression, so what should we do in this case? I encountered this need some time ago. When requesting data, the string returned by the background contains expression strings of this type: sad:. If the content is directly displayed on the Label, it will also display: sad:. I searched for a lot of information in this form, and found that it had to be processed by mixing pictures and text. Many of the expression strings were in the form of [crying], and then I was a bit confused about the form: sad: , and later I used regular methods to deal with it, and found that it was really easy to use. It also solved the adaptive height problem of tableviewCell. The emoji expression conversion PHP library perfectly solves this problem

    Other libraries22172017-12-13
  • Today I will bring you a command line PHP library that runs in parallel on multiple remote machines. Let’s look at a piece of code. <?php namespace League\Shunt; use League\Shunt\Contracts\SCPInterface; use League\Shunt\Contracts\SessionInterface; use League\Shunt\BaseObject; use Symfony\Component\Console\Output\OutputInterface; use RuntimeException; class SCP extends BaseObject implements SCPInterface {     protected $session;     public function __construct(SessionInterface $session, OutputInterface $output)     {         // Set the base object properties         parent::__construct($session, $output);         if ( ! $session->valid()) throw new RuntimeException('SSH connection failed.');         $this->session = $session;     }     public function put($localFile = '', $remoteFile = '')     {         return $this->doRun(__METHOD__, func_get_args(), ssh2_scp_send($this->session->getConnection(), $localFile, $remoteFile));     }     public function get($remoteFile = '', $localFile = '')     {         return $this->doRun(__METHOD__, func_get_args(), ssh2_scp_recv($this->session->getConnection(), $remoteFile, $localFile));     } }

    Other libraries11902017-12-12
  • As we all know, there are many ways to parse tags. Today we will bring a PHP library that uses lightweight tags to parse, let’s take a look. <?php namespace Decoda; use Decoda\Decoda; use Decoda\Loader\FileLoader; use Decoda\Test\TestCase; use Decoda\Test\TestComponent; class ComponentTest extends TestCase {     protected function setUp() {         parent::setUp();         $this->object = new TestComponent(array('key' => 'value'));     }     public function testAddGetLoaders() {         $this->assertEquals(0, count($this->object->getLoaders()));         $this->object->addLoader(new FileLoader(TEST_DIR . '/config/test.php'));         $this->assertEquals(1, count($this->object->getLoaders()));     }     public function testGetSetConfig() {         $this->assertEquals('value', $this->object->getConfig('key'));         $this->assertEquals(null, $this->object->getConfig('foobar'));         $this->object->setConfig(array('key' => 'foo'));         $this->assertEquals('foo', $this->object->getConfig('key'));     }     public function testGetSetParser() {         $this->assertEquals(null, $this->object->getParser());         $this->object->setParser(new Decoda());         $this->assertInstanceOf('Decoda\Decoda', $this->object->getParser());     }     public function testMessage() {         $this->object->setParser(new Decoda());         $this->assertEquals('Quote by {author}', $this->object->message('quoteBy'));     } }

    Other libraries10432017-12-12
  • we know. A command is a work prompt in the operating system that prompts for command input. The command prompt varies in different operating system environments. In the Windows environment, the command line program is cmd.exe, which is a 32-bit command line program. The Microsoft Windows system is based on the command interpreter on Windows, similar to Microsoft's DOS operating system. Enter some commands and cmd.exe can execute them. For example, entering shutdown -s will shut down the computer after 30 seconds. All in all, it's very useful. Open method: Start-All Programs-Accessories or Start-Search-Enter: cmd/cmd.exe and press Enter. It can also execute BAT files. This time the editor has summarized some simple command line packaged PHP libraries for you. Let’s take a look. <?php require_once __DIR__ . '/../vendor/autoload.php'; use MrRio\ShellWrap as sh; // List all files in current dir echo sh::ls(); // Touch a file to create it sh::touch('file.html');

    Other libraries13052017-12-12
  • Cron scheduled tasks are tasks that execute planned work at the agreed time. This is what it means on the surface. In Linux, we often use cron server to complete this work. The cron server can perform specific tasks according to the time specified in the configuration file. <?php namespace Cron; abstract class AbstractField implements FieldInterface {     protected $fullRange = [];     protected $literals = [];     protected $rangeStart;     protected $rangeEnd;     public function __construct()     {         $this->fullRange = range($this->rangeStart, $this->rangeEnd);     }     public function isSatisfied($dateValue, $value)     {         if ($this->isIncrementsOfRanges($value)) {             return $this->isInIncrementsOfRanges($dateValue, $value);         } elseif ($this->isRange($value)) {             return $this->isInRange($dateValue, $value);         }         return $value == '*' || $dateValue == $value;     }

    Other libraries11092017-12-12