Home > Download >  Library download

  • <?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 'On'); chdir(__DIR__); $configFile = 'server-config.php'; if (!file_exists($configFile) || !is_readable($configFile)) { trigger_error('Unable to read configuration file: ' . $configFile . ' Use server-config.php.dist as a template to create server-config.php.dist'); } include $configFile; $helperSet = (isset($helperSet)) ? $helperSet : new \Symfony\Component\Console\Helper\HelperSet(); $cli = new \Symfony\Component\Console\Application('Drest Server Command Line Interface Tool'); $cli->setCatchExceptions(true); $cli->setHelperSet($helperSet); $cli->addCommands(array( // Drest Commands     new Drest\Tools\Console\Command\CheckDefinitions(),     new Drest\Tools\Console\Command\CheckProductionSettings() )); $cli->run();Doctrine is an ORM based on the database abstraction layer. It can easily access all databases through PHP objects, such as MYSQL. REST has nothing to do with technology. It represents a software architecture style, REST It is the abbreviation of Representational State Transfer, and the Chinese translation is "Representational State Transfer" REST looks at the entire network from the perspective of resources. It identifies the resources distributed at a certain node in the network through URLs, and the client application Obtain representations of resources through URLs, and obtaining these representations causes these applications to change statesAll data, whether obtained through the network or data operated (add, delete, modify, check), are resources, treat all data as Resources are the most essential attribute that distinguishes REST from other architectural styles. For the resource-oriented architectural style of REST, someone has proposed a new structural concept, namely: Resource Oriented Architecture (ROA) ##

    Other libraries11662017-12-21
  • <?php namespace DMS\Filter; class Filter implements FilterInterface {     protected $metadataFactory;     protected $filterLoader;     public function __construct(Mapping\ClassMetadataFactory $metadataFactory, $filterLoader)     {         $this->metadataFactory = $metadataFactory;         $this->filterLoader    = $filterLoader;     }     public function filterEntity($object)     {         $this->walkObject($object);     }     public function filterProperty($object, $property)     {         $this->walkObject($object, $property);     }PHP filters are used to validate and filter data from non-secure sources. Testing, validating, and filtering user input or custom data are important parts of any web application. PHP's filter extension is designed to make data filtering easier and faster. Why use filters? Almost all web applications rely on external input. This data usually comes from users or other applications (such as web services). By using filters, you can ensure that your application gets the correct input type. You should always filter external data! Input filtering is one of the most important application security topics.

    Other libraries20392017-12-21
  • <?php namespace ByteUnits; class ArithmeticTest extends \PHPUnit_Framework_TestCase {     public function testAddInSameUnitSystem()     {         $this->assertEquals(Metric::bytes(10), Metric::bytes(5)->add(Metric::bytes(5)));         $this->assertEquals(Binary::bytes(10), Binary::bytes(5)->add(Binary::bytes(5)));     }     public function testRemoveInSameUnitSystem()     {         $this->assertEquals(Metric::bytes(3), Metric::bytes(5)->remove(Metric::bytes(2)));         $this->assertEquals(Binary::bytes(3), Binary::bytes(5)->remove(Binary::bytes(2)));     }     public function testAutoboxing()     {         $this->assertEquals(Metric::bytes(10), Metric::bytes(5)->add(5));         $this->assertEquals(Metric::bytes(10), Metric::bytes(5)->add('5B'));         $this->assertEquals(Metric::bytes(3), Metric::bytes(5)->remove(2));         $this->assertEquals(Metric::bytes(3), Metric::bytes(5)->remove('2B'));     }This library can quickly help you convert byte units. 1 byte is equal to 8 bitThat is, 1byte = 8 bit, the following is the conversion of KB, MB, GB, TB1KB = 1024 byte1MB = 1024KB = 1024 X 1024byte1GB = 1024MB1TB = 1024GB

    Other libraries11902017-12-21
  • <?php namespace KzykHys\Text; class Text implements \Serializable {     private $text;     public function __construct($text = '')     {         $this->text = (string) $text;     }     public static function create($text = '')     {         return new static($text);     }         public function append($text)     {         $this->text .= (string) $text;         return $this;     }This is a static regular expression library. TPL stands for Text Processing Library. spirit and expressive are very good things, and the TPL library can learn from them. The reason for developing the TPL library seems funny: the reason is that spirit and xpressive are too slow. It's not that execution is slow, but that compilation is slow.

    Other libraries21102017-12-20
  • <?php namespace Swap\Service; use Exchanger\Service\Service; use Http\Client\HttpClient; use Http\Discovery\HttpClientDiscovery; use Http\Discovery\MessageFactoryDiscovery; use Http\Message\RequestFactory; class Factory {     private $httpClient;     private $requestFactory;     private $registry;     public function __construct(HttpClient $httpClient = null, RequestFactory $requestFactory = null)     {         $this->httpClient = $httpClient ?: HttpClientDiscovery::find();         $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find();         $this->registry = new Registry();     }     public function setHttpClient(HttpClient $httpClient)     {         $this->httpClient = $httpClient;     }     public function setRequestFactory(RequestFactory $requestFactory)     {         $this->requestFactory = $requestFactory;     }Exchange rate refers to the ratio or price comparison between one country's currency and another country's currency, or the price of another country's currency expressed in one country's currency. Exchange rate changes have a direct regulatory effect on a country's import and export trade. Under certain conditions, external devaluation of the domestic currency, that is, an increase in the exchange rate, will play the role of promoting exports and restricting imports; conversely, external appreciation of the domestic currency, that is, a decrease in the exchange rate, will play the role of restricting exports and increasing imports.

    Other libraries12552017-12-20
  • <?php require_once __DIR__ . '/../bootstrap.php'; $loop = \React\EventLoop\Factory::create(); $scheduler = new \Rx\Scheduler\EventLoopScheduler($loop); $source1 = \Rx\Observable::fromArray(range(0, 100)); $source2 = \Rx\Observable::fromArray(range(0, 100)); $source = $source1->combineLatest([$source2], function($value1, $value2){     return "First: {$value1}, Second: {$value2}"; })->take(4); $subscription = $source->subscribe($stdoutObserver, $scheduler); $loop->run();The extension library is a function of PHP extension. For example, PHP does not originally support operating a certain function, but if you want to support it in the new version, it will be provided in an extended way. In this way, when we configure PHP, if we Without this function, we can prevent php from loading it, thus saving server resources and providing its performance The extension library of php is generally placed in the ext directory under the php directory. After decompressing the php compressed package you downloaded online, it should You can see that extension_dir in php.ini is used to specify the address of your extension.

    Other libraries25122017-12-20
  • 套接字的编程步骤 在使用之前须链接库函数:工程->设置->Link->输入ws2_32.lib,OK! SOCKET sockSrv=socket(AF_INET,SOCK_STREAM,0);//创建套接字(socket)。 SOCKADDR_IN addrSrv; addrSrv.sin_addr.S_un.S_addr=htonl(INADDR_ANY);//转换Unsigned short为网络字节序的格式 addrSrv.sin_family=AF_INET; addrSrv.sin_port=htons(6000); 客户端代码如下: #include <Winsock2.h> #include <stdio.h> void main() { WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 1, 1 ); err = WSAStartup( wVersionRequested, &wsaData );加载套接字库 if ( err != 0 ) { return; } if ( LOBYTE( wsaData.wVersion ) != 1 || HIBYTE( wsaData.wVersion ) != 1 ) { WSACleanup()( ); return;  } SOCKET sockClient=socket(AF_INET,SOCK_STREAM,0);创建套接字(socket)。 SOCKADDR_IN addrSrv; addrSrv.sin_addr.S_un.S_addr=inet_addr("127.0.0.1"); addrSrv.sin_family=AF_INET; addrSrv.sin_port=htons(6000); connect(sockClient,(SOCKADDR*)&addrSrv,sizeof(SOCKADDR));向服务器发出连接请求(connect)。 char recvBuf[100];和服务器端进行通信(send/recv)。 recv(sockClient,recvBuf,100,0); printf("%s\n",recvBuf); send(sockClient,"This is lisi",strlen("This is lisi")+1,0); closesocket(sockClient);关闭套接字。 WSACleanup()();//必须调用这个函数清除参数 }

    Other libraries13732017-12-20
  • This is a client that can send and receive messages. Let me demonstrate the sending and receiving operations for you. Friends who need it can download it and try it out. Send message<?phptry {     $rcf = new RdKafka\Conf();     $rcf->set('group.id', 'test');     $cf = new RdKafka\TopicConf();     $cf->set('offset.store.method', 'broker');     $cf->set('auto.offset.reset', 'smallest');     $rk = new RdKafka\Producer($rcf);     $rk->setLogLevel(LOG_DEBUG);     $rk->addBrokers("127.0.0.1");     $topic = $rk->newTopic("test", $cf);     for($i = 0; $i < 1000; $i++) {         $topic->produce(0,0,'test' . $i);//没有setMessge接口了,使用produce  参考:https://libraries.io/github/mentionapp/php-rdkafka     }  } catch (Exception $e) {     echo $e->getMessage();Receive message<?phptry {     $rcf = new RdKafka\Conf();     $rcf->set('group.id', 'test');     $cf = new RdKafka\TopicConf();/*     $cf->set('offset.store.method', 'file'); */     $cf->set('auto.offset.reset', 'smallest');     $cf->set('auto.commit.enable', true);     $rk = new RdKafka\Consumer($rcf);     $rk->setLogLevel(LOG_DEBUG);     $rk->addBrokers("127.0.0.1");     $topic = $rk->newTopic("test", $cf);    //$topic->consumeStart(0, RD_KAFKA_OFFSET_BEGINNING);     while (true) {         $topic->consumeStart(0, RD_KAFKA_OFFSET_STORED);         $msg = $topic->consume(0, 1000);         var_dump($msg);        if ($msg->err) {            echo $msg->errstr(), "\n";            break;         } else {            echo $msg->payload, "\n";         }         $topic->consumeStop(0);         sleep(1);     } } catch (Exception $e) {    echo $e->getMessage(); }

    Other libraries27342017-12-20
  • <div class="form-group">      <label for="tag">标签</label>      <select name="tag" value='{$result["tag"]}' class="form-control input-lg">      <option value="shenghuomiaozhao" <?php echo ($result["tag"]=="shenghuomiaozhao")?"selected":"" ?>>生活妙招</option>     <option value="fenleijieshao"    <?php echo ($result["tag"]=="fenleijieshao")?"selected":""?>    >分类介绍</option>     <option value="huanbaohudong"    <?php echo ($result["tag"]=="huanbaohudong")?"selected":""?>    >环保互动</option>     <option value="huishouliucheng"  <?php echo ($result["tag"]=="huishouliucheng")?"selected":""?>  >回收流程</option>     </select>                 </div>This is an option type PHP library, the final effect. If you need it, you can directly download this php-option-master option type library

    Other libraries25772017-12-20
  • php artisan migrate #输出Migration table created successfully. Migrated: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_100000_create_password_resets_table php artisan migrate:rollback #输出Rolled back: 2014_10_12_100000_create_password_resets_table Rolled back: 2014_10_12_000000_create_users_table php artisan make:migration create_article_table --create='articles' #输出Created Migration: 2015_03_28_050138_create_article_table <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateArticleTable extends Migration {    /**  * Run the migrations.  *  * @return void  */  public function up()  {  Schema::create('articles', function(Blueprint $table)  {   $table->increments('id');   $table->timestamps();  });  }    /**  * Reverse the migrations.  *  * @return void  */  public function down()  {  Schema::drop('articles');  }   }database migrations is one of laravel's most powerful features. Database migration can be understood as a version controller for the database. Contains two migration files in the database/migrations directory, one to create the user table and one for user password reset. In the migration file, the up method is used to create the data table, and the down method is used to roll back, that is, delete the data table.

    Other libraries17622017-12-20
  • <?php /**  * Munee: Optimising Your Assets  *  * @copyright Cody Lundquist 2013  * @license http://opensource.org/licenses/mit-license.php  */ $ds = DIRECTORY_SEPARATOR; $muneePath = __DIR__ . $ds . '..'; spl_autoload_register(function ($class) use ($ds, $muneePath) {     $path = str_replace('\', DIRECTORY_SEPARATOR, $class);     foreach (array('src', 'tests') as $dirPrefix) {         $file = $muneePath . $ds . $dirPrefix . $ds . $path . '.php';         if (file_exists($file)) {             require_once $file;             break;         }     } }); defined('WEBROOT') || define('WEBROOT', __DIR__ . $ds . 'tmp'); require_once $muneePath . $ds . 'config' . $ds . 'bootstrap.php';Image compression and cropping, CSS, JS file merging and minification, these tasks are essential in website development, but if you do all these tasks yourself, it will be very troublesome, so today I recommend one for Full-featured PHP class library for optimizing images, CSS, JS and other website attachments: Munee. Munee has a very powerful caching function that can cache resources on the server and client servers. And it integrates the tool Imagine for image processing, which can quickly adjust the image size online, or crop the image, etc. Munee can automatically compile LESS, SCSS and CoffeeScript, and can also merge multiple CSS and JS files into a single request, as well as minify and GZip these files to save bandwidth and better website performance.

    Other libraries15392017-12-20
  • Monolog is a relatively complete and easily expandable logging library under PHP. Currently, many well-known PHP frameworks including Symfony, Laravel, CakePHP, etc. have built-in Monolog. Monolog can send your logs to files, sockets, inboxes, databases and various web services. Monolog follows the PSR3 interface specification and can be easily replaced with other logging libraries that follow the same specification. Monolog has good scalability. Through the interfaces Handler, Formatter and Processor, the Monolog class library can be extended and customized in various ways. Basic usage<?php  use Monolog\Logger;  use Monolog\Handler\StreamHandler;    // 创建日志频道  $log = new Logger('name');  $log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));    // 添加日志记录  $log->addWarning('Foo');  $log->addError('Bar');Core conceptEach Logger instance contains a channel name (channel) and a handler stack. When you add a record, the record is processed through the handler stack. Each handler can also decide whether to pass the record to the next handler in the next stack. Through handlers, we can implement some complex log operations. For example, if we put the StreamHandler at the bottom of the stack, all log records will eventually be written to the hard disk file. At the same time, we put the MailHandler at the top of the stack and send the error log via email by setting the log level. There is a $bubble attribute in Handler. This attribute defines whether the handler intercepts records and prevents them from flowing to the next handler. So if we set the $bubble parameter of MailHandler to false, when an error log occurs, the log will be sent through MailHandler instead of being written to the hard disk through StreamHandler. Multiple Loggers can be created, and each can define its own channel name and handler stack. Handlers can be shared among multiple Loggers. The channel name will be reflected in the log, making it easier for us to view and filter log records. If the log format (Formatter) is not specified, Handler will use the default Formatter. The log levels cannot be customized. Currently, the eight levels defined in RFC 5424 are used: debug, info, notice, warning, error, critical, alert, and emergency. If you have other needs for log records, you can add content to the log records through Processo. Log levelDEBUG (100): Detailed debug information. INFO (200): Key event. NOTICE (250): An ordinary but important event. WARNING (300): A non-error exception occurred. ERROR (400): Runtime error, but does not need to be handled immediately. CRITICA (500): Serious error. EMERGENCY (600): The system is unavailable.

    Other libraries29542017-12-20