Home > Download >  Library download

  • <?php namespace Lurker\Tests\Event; use Lurker\Resource\FileResource; use Lurker\Resource\DirectoryResource; use Lurker\Event\FilesystemEvent; use Lurker\Resource\TrackedResource; class FilesystemEventTest extends \PHPUnit_Framework_TestCase {     public function testConstructAndGetters()     {         $event = new FilesystemEvent(             $tracked  = new TrackedResource(23, new DirectoryResource(__DIR__)),             $resource = new FileResource(__FILE__),             $type     = FilesystemEvent::MODIFY         );         $this->assertSame($tracked, $event->getTrackedResource());         $this->assertSame($resource, $event->getResource());         $this->assertSame($type, $event->getType());     }     public function testIsFileChange()     {         $event = new FilesystemEvent(             $tracked  = new TrackedResource(23, new DirectoryResource(__DIR__.'/../')),             $resource = new FileResource(__FILE__),             $type     = FilesystemEvent::MODIFY         );         $this->assertTrue($event->isFileChange());         $this->assertFalse($event->isDirectoryChange());     }This is a resource tracking PHP class library, friends who need it can download it and use it.

    Other libraries20962018-01-04
  • <?php namespace Stampie\Adapter; use Buzz\Browser; use Buzz\Message\Form\FormUpload; use Buzz\Message\RequestInterface; class Buzz implements AdapterInterface {     /**      * @var Browser $browser      */     protected $browser;     /**      * @param Browser $browser      */     public function __construct(Browser $browser)     {         $this->browser = $browser;     }     /**      * @return Browser      */     public function getBrowser()     {         return $this->browser;     }This is a PHP library for email services. Friends who need it can download it and use it.

    Mail class library62822018-01-04
  • <?php /**  * Simple autoloader that follow the PHP Standards Recommendation #0 (PSR-0)  * @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md for more informations.  *  * Code inspired from the SplClassLoader RFC  * @see https://wiki.php.net/rfc/splclassloader#example_implementation  */ spl_autoload_register(function ($className) {     $className = ltrim($className, '\');     $fileName = '';     if ($lastNsPos = strripos($className, '\')) {         $namespace = substr($className, 0, $lastNsPos);         $className = substr($className, $lastNsPos + 1);         $fileName = str_replace('\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;     }     $fileName = __DIR__ . DIRECTORY_SEPARATOR . $fileName . $className . '.php';     if (file_exists($fileName)) {         require $fileName;         return true;     }     return false; });This is a PHP email reply parser library, friends who need it can download it and use it.

    Mail class library52442018-01-04
  • <?php class HasMxTest extends PHPUnit_Framework_TestCase {     /**      * Set up for tests in this file.      *      * @access private      */     private function setupTest()     {         $this->validator = new \EmailValidator\Validator();     }     /**      * Test hasMx      *      * @cover \EmailValidator\Validator::hasMx      */     public function testHasMx()     {         $this->setupTest();         // Not an email         $this->assertNull(             $this->validator->hasMx('example.com')         );         // No Records         $this->assertFalse(             $this->validator->hasMx('example@example.com')         );         // Records         $this->assertTrue(             $this->validator->hasMx('example@google.com')         );         $this->assertTrue(             $this->validator->hasMx('example@yahoo.com')         );     } }This is a PHP email verification library, friends who need it can download and use

    Mail class library54412018-01-04
  • <?php namespace Hoa\Mime; use Hoa\Consistency; use Hoa\Stream; use Hoa\Zformat;  */ class Mime implements Zformat\Parameterizable {     const STRUCTURE_MEDIA_TYPE = 0;     const STRUCTURE_EXTENSION  = 1;     const MIME_MEDIA           = 0;     const MIME_TYPE            = 1;     private $_parameters        = null;      * Computed magic file.      * Structure:      *     array(      *         structure_media_type => array(      *             media => array(      *                 type => array(extensions)      *             )      *         ),      *         structure_extension  => array(      *             extension => media/type      *         )      *     )      *      * @var arrayThis is a MIME detection PHP library, friends who need it can download and use

    Other libraries18092018-01-04
  • <?php class Category {   private $model;                                                           //分类的数据表模型   private $rawList = array();                                              //原始的分类数据   private $formatList = array();                                           //格式化后的分类   private $error = "";                                                      //错误信息   private $icon = array('&nbsp;&nbsp;│', '&nbsp;&nbsp;├ ', '&nbsp;&nbsp;└ ');  //格式化的字符   private $fields = array();                                               /   public function __construct($model = '', $fields = array()) {     if (is_string($model) && (!empty($model))) {       if (!$this->model = D($model))         $this->error = $model . "模型不存在!";     }     if (is_object($model))       $this->model = &$model;     $this->fields['cid'] = $fields['0'] ? $fields['0'] : 'id';     $this->fields['pid'] = $fields['1'] ? $fields['1'] : 'pid';     $this->fields['name'] = $fields['2'] ? $fields['2'] : 'name';     $this->fields['fullname'] = $fields['3'] ? $fields['3'] : 'fullname';   }This is a PHP category library with unlimited categories. Friends who need it can download it and use it.

    Other libraries31532018-01-03
  • <?php class File {   private $_dir;   const EXT = '.txt';   public function __construct() {     $this->_dir = dirname(__FILE__) . '/files/';   }   public function cacheData($key, $value = '', $cacheTime = 0) {     $filename = $this->_dir  . $key . self::EXT;     if($value !== '') { // 将value值写入缓存       if(is_null($value)) {  //$value  为null 将删除缓存         return @unlink($filename);       }       //目录不存在建立目录       $dir = dirname($filename);       if(!is_dir($dir)) {         mkdir($dir, 0777);       }       //设置定长缓存时间,保存到缓存文件中       $cacheTime = sprintf('%011d', $cacheTime);       return file_put_contents($filename,$cacheTime . json_encode($value));     }This is a PHP file caching library, friends who need it can download and use

    Other libraries24112018-01-03
  • <?php class Cache {   private $dir;   private $lifetime;   private $cacheid;   private $ext;   function __construct($dir='',$lifetime=1800) {     if ($this->dir_isvalid($dir)) {       $this->dir = $dir;       $this->lifetime = $lifetime;       $this->ext = '.Php';       $this->cacheid = $this->getcacheid();     }   }   private function isvalid() {     if (!file_exists($this->cacheid)) return false;     if (!(@$mtime = filemtime($this->cacheid))) return false;     if (mktime() - $mtime > $this->lifetime) return false;     return true;   }This is a cache class library implemented in PHP. Friends who need it can download and use

    Other libraries18772018-01-03
  • <?php class mysql {   private $defaultDB = null;   private $link = null;   private $sql = null;   private $bindValue = null;   public $num_rows = 0;   public $affected_rows = 0;   public $insert_id = 0;   public $queries = 0;   public function __construct() {     if(func_num_args()) {       $argv = func_get_arg(0);       if(!empty($argv) && is_array($argv)) {         $this->connect($argv);         $argv['charset'] = isset($argv['charset']) ? $argv['charset'] : 'utf8';         $this->setCharset($argv['charset']);       }     }   }This is a tool class for php to connect to mysql. Friends who need it can download and use

    Other libraries27932018-01-03
  • <?php define("TOKEN", "weixin"); $wechatObj = new wechatCallbackapiTest(); if (!isset($_GET['echostr'])) {   $wechatObj->responseMsg(); }else{   $wechatObj->valid(); } class wechatCallbackapiTest {   //验证消息   public function valid()   {     $echoStr = $_GET["echostr"];     if($this->checkSignature()){       echo $echoStr;       exit;     }   }This is a php WeChat public platform development interface class. Friends who need it can download and use

    Other libraries43432018-01-03
  • <?php <?php set_time_limit(0); $urls = array('http://www.baidu.com','http://www.php.cn',); $handle = curl_multi_init(); $curls = array(); foreach ($urls as $k=>$url) { $curls[$k] = add_handle($handle, $url); } function add_handle(& $handle, $url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, ''); curl_setopt($curl,CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)");        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_multi_add_handle($handle, $curl); return $curl; }This is a PHP curl multi-thread collection class. Friends who need it can download it and use it.

    Other libraries31982018-01-03
  • /**  * 生成二维码  * @param  string  $url  url连接  * @param  integer $size 尺寸 纯数字  */ function qrcode($url,$size=4){     Vendor('Phpqrcode.phpqrcode');     // 如果没有http 则添加     if (strpos($url, 'http')===false) {         $url='http://'.$url;     }     QRcode::png($url,false,QR_ECLEVEL_L,$size,2,false,0xFFFFFF,0x000000); }The first parameter $text; is the URL parameter in the above code; The second parameter $outfile defaults to No; no file is generated; only the QR code image is returned; otherwise storage needs to be provided Path to generate QR code images; The third parameter $level defaults to L; the values ​​that can be passed by this parameter are L(QR_ECLEVEL_L, 7%), M(QR_ECLEVEL_M, 15%), Q(QR_ECLEVEL_Q, 25 %), H(QR_ECLEVEL_H, 30%); this parameter controls the error tolerance rate of the QR code; different parameters indicate the percentage of the area that the QR code can cover. Taking advantage of the fault tolerance rate of QR code; we can place the avatar in any area of ​​the generated QR code image; The fourth parameter $size; controls the size of the generated image; the default is 4; The fifth Parameter $margin; controls the size of the blank area for generating QR codes; The sixth parameter $saveandprint; saves the QR code image and displays it; $outfile must pass the image path; The seventh parameter $back_color; Background color; The eighth parameter $fore_color; the color of drawing QR code;

    Other libraries35222018-01-02