use msgpack php extension rather than composer package

This commit is contained in:
Ben Harris 2017-04-25 19:37:27 -04:00
parent f4f7b5bdd6
commit cadd225ebf
4 changed files with 59 additions and 101 deletions

View File

@ -13,7 +13,6 @@
"team-reflex/discord-php": "dev-develop",
"guzzlehttp/guzzle": "~6.0",
"vlucas/phpdotenv": "^2.4",
"rybakit/msgpack": "^0.2.2",
"voku/stringy": "^2.2"
},
"autoload": {

153
composer.lock generated
View File

@ -4,8 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "09f4876b867821345035442780bffc72",
"content-hash": "1d2019dc226f17f3580127036c7c2b6a",
"content-hash": "5afada62d33dcd58b88a885347c95bf1",
"packages": [
{
"name": "TrafficCophp/ByteBuffer",
@ -49,7 +48,7 @@
"stream",
"wrapper"
],
"time": "2016-01-13 22:50:58"
"time": "2016-01-13T22:50:58+00:00"
},
{
"name": "cache/adapter-common",
@ -104,7 +103,7 @@
"psr-6",
"tag"
],
"time": "2016-07-31 18:10:41"
"time": "2016-07-31T18:10:41+00:00"
},
{
"name": "cache/array-adapter",
@ -167,7 +166,7 @@
"psr-6",
"tag"
],
"time": "2016-08-07 15:04:55"
"time": "2016-08-07T15:04:55+00:00"
},
{
"name": "cache/hierarchical-cache",
@ -224,7 +223,7 @@
"psr-6",
"tag"
],
"time": "2016-08-07 14:49:33"
"time": "2016-08-07T14:49:33+00:00"
},
{
"name": "cache/taggable-cache",
@ -282,7 +281,7 @@
"psr6",
"tag"
],
"time": "2016-08-08 17:20:09"
"time": "2016-08-08T17:20:09+00:00"
},
{
"name": "doctrine/inflector",
@ -349,7 +348,7 @@
"singularize",
"string"
],
"time": "2015-11-06 14:35:42"
"time": "2015-11-06T14:35:42+00:00"
},
{
"name": "evenement/evenement",
@ -395,7 +394,7 @@
"event-dispatcher",
"event-emitter"
],
"time": "2012-11-02 14:49:47"
"time": "2012-11-02T14:49:47+00:00"
},
{
"name": "guzzlehttp/guzzle",
@ -457,7 +456,7 @@
"rest",
"web service"
],
"time": "2017-02-28 22:50:30"
"time": "2017-02-28T22:50:30+00:00"
},
{
"name": "guzzlehttp/promises",
@ -508,7 +507,7 @@
"keywords": [
"promise"
],
"time": "2016-12-20 10:07:11"
"time": "2016-12-20T10:07:11+00:00"
},
{
"name": "guzzlehttp/psr7",
@ -573,11 +572,11 @@
"uri",
"url"
],
"time": "2017-03-20 17:10:46"
"time": "2017-03-20T17:10:46+00:00"
},
{
"name": "illuminate/contracts",
"version": "v5.4.17",
"version": "v5.4.19",
"source": {
"type": "git",
"url": "https://github.com/illuminate/contracts.git",
@ -615,20 +614,20 @@
],
"description": "The Illuminate Contracts package.",
"homepage": "https://laravel.com",
"time": "2017-03-29 13:17:47"
"time": "2017-03-29T13:17:47+00:00"
},
{
"name": "illuminate/support",
"version": "v5.4.17",
"version": "v5.4.19",
"source": {
"type": "git",
"url": "https://github.com/illuminate/support.git",
"reference": "c7e7c9daf5044e76b46085b8351f8235a3e979c6"
"reference": "b8cb37e15331c59da51c8ee5838038baa22d7955"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/support/zipball/c7e7c9daf5044e76b46085b8351f8235a3e979c6",
"reference": "c7e7c9daf5044e76b46085b8351f8235a3e979c6",
"url": "https://api.github.com/repos/illuminate/support/zipball/b8cb37e15331c59da51c8ee5838038baa22d7955",
"reference": "b8cb37e15331c59da51c8ee5838038baa22d7955",
"shasum": ""
},
"require": {
@ -672,7 +671,7 @@
],
"description": "The Illuminate Support package.",
"homepage": "https://laravel.com",
"time": "2017-03-28 12:49:45"
"time": "2017-04-09T14:34:57+00:00"
},
{
"name": "ircmaxell/password-compat",
@ -714,7 +713,7 @@
"hashing",
"password"
],
"time": "2014-11-20 16:49:30"
"time": "2014-11-20T16:49:30+00:00"
},
{
"name": "monolog/monolog",
@ -792,7 +791,7 @@
"logging",
"psr-3"
],
"time": "2017-03-13 07:08:03"
"time": "2017-03-13T07:08:03+00:00"
},
{
"name": "nesbot/carbon",
@ -845,7 +844,7 @@
"datetime",
"time"
],
"time": "2017-01-16 07:55:07"
"time": "2017-01-16T07:55:07+00:00"
},
{
"name": "paragonie/random_compat",
@ -893,7 +892,7 @@
"pseudorandom",
"random"
],
"time": "2017-03-13 16:27:32"
"time": "2017-03-13T16:27:32+00:00"
},
{
"name": "psr/cache",
@ -939,7 +938,7 @@
"psr",
"psr-6"
],
"time": "2016-08-06 20:24:11"
"time": "2016-08-06T20:24:11+00:00"
},
{
"name": "psr/http-message",
@ -989,7 +988,7 @@
"request",
"response"
],
"time": "2016-08-06 14:39:51"
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
@ -1036,7 +1035,7 @@
"psr",
"psr-3"
],
"time": "2016-10-10 12:19:37"
"time": "2016-10-10T12:19:37+00:00"
},
{
"name": "ratchet/pawl",
@ -1081,7 +1080,7 @@
"websocket",
"websocket client"
],
"time": "2016-04-14 21:43:44"
"time": "2016-04-14T21:43:44+00:00"
},
{
"name": "ratchet/rfc6455",
@ -1129,7 +1128,7 @@
"rfc6455",
"websocket"
],
"time": "2017-01-01 15:41:18"
"time": "2017-01-01T15:41:18+00:00"
},
{
"name": "react/cache",
@ -1163,7 +1162,7 @@
"keywords": [
"cache"
],
"time": "2016-02-25 18:17:16"
"time": "2016-02-25T18:17:16+00:00"
},
{
"name": "react/datagram",
@ -1217,7 +1216,7 @@
"server",
"udp"
],
"time": "2017-01-23 20:47:30"
"time": "2017-01-23T20:47:30+00:00"
},
{
"name": "react/dns",
@ -1259,7 +1258,7 @@
"dns",
"dns-resolver"
],
"time": "2017-04-16 11:20:57"
"time": "2017-04-16T11:20:57+00:00"
},
{
"name": "react/event-loop",
@ -1303,7 +1302,7 @@
"asynchronous",
"event-loop"
],
"time": "2016-03-08 02:09:32"
"time": "2016-03-08T02:09:32+00:00"
},
{
"name": "react/http-client",
@ -1346,7 +1345,7 @@
"keywords": [
"http"
],
"time": "2017-03-20 09:55:48"
"time": "2017-03-20T09:55:48+00:00"
},
{
"name": "react/partial",
@ -1388,7 +1387,7 @@
"functional-programming",
"partial"
],
"time": "2014-12-12 16:39:23"
"time": "2014-12-12T16:39:23+00:00"
},
{
"name": "react/promise",
@ -1434,7 +1433,7 @@
"promise",
"promises"
],
"time": "2017-03-25 12:08:31"
"time": "2017-03-25T12:08:31+00:00"
},
{
"name": "react/promise-timer",
@ -1484,20 +1483,20 @@
"timeout",
"timer"
],
"time": "2016-12-27 08:12:19"
"time": "2016-12-27T08:12:19+00:00"
},
{
"name": "react/socket",
"version": "v0.7.1",
"version": "v0.7.2",
"source": {
"type": "git",
"url": "https://github.com/reactphp/socket.git",
"reference": "57e3262b4b6098f7343cf16df393099dad5d5f11"
"reference": "05b2fa7df1f87ba1d7d3c703c77b1eed02b171f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/socket/zipball/57e3262b4b6098f7343cf16df393099dad5d5f11",
"reference": "57e3262b4b6098f7343cf16df393099dad5d5f11",
"url": "https://api.github.com/repos/reactphp/socket/zipball/05b2fa7df1f87ba1d7d3c703c77b1eed02b171f2",
"reference": "05b2fa7df1f87ba1d7d3c703c77b1eed02b171f2",
"shasum": ""
},
"require": {
@ -1532,7 +1531,7 @@
"reactphp",
"stream"
],
"time": "2017-04-10 20:52:43"
"time": "2017-04-24T09:37:03+00:00"
},
{
"name": "react/socket-client",
@ -1574,7 +1573,7 @@
"keywords": [
"Socket"
],
"time": "2016-12-06 10:54:49"
"time": "2016-12-06T10:54:49+00:00"
},
{
"name": "react/stream",
@ -1618,49 +1617,7 @@
"pipe",
"stream"
],
"time": "2017-01-25 14:44:14"
},
{
"name": "rybakit/msgpack",
"version": "v0.2.2",
"source": {
"type": "git",
"url": "https://github.com/rybakit/msgpack.php.git",
"reference": "62ef0f629dbbe855ffed38d1b4c4d1130b6195a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rybakit/msgpack.php/zipball/62ef0f629dbbe855ffed38d1b4c4d1130b6195a9",
"reference": "62ef0f629dbbe855ffed38d1b4c4d1130b6195a9",
"shasum": ""
},
"require": {
"php": "^5.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"MessagePack\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eugene Leonovich",
"email": "gen.work@gmail.com"
}
],
"description": "A pure PHP implementation of the MessagePack serialization format.",
"keywords": [
"messagepack",
"msgpack",
"pure",
"streaming"
],
"time": "2017-03-11 15:48:37"
"time": "2017-01-25T14:44:14+00:00"
},
{
"name": "symfony/intl",
@ -1735,7 +1692,7 @@
"l10n",
"localization"
],
"time": "2017-03-05 17:42:14"
"time": "2017-03-05T17:42:14+00:00"
},
{
"name": "symfony/options-resolver",
@ -1789,7 +1746,7 @@
"configuration",
"options"
],
"time": "2017-03-21 21:44:32"
"time": "2017-03-21T21:44:32+00:00"
},
{
"name": "symfony/polyfill",
@ -1878,7 +1835,7 @@
"polyfill",
"shim"
],
"time": "2016-11-14 01:15:23"
"time": "2016-11-14T01:15:23+00:00"
},
{
"name": "symfony/translation",
@ -1942,7 +1899,7 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2017-03-21 21:44:32"
"time": "2017-03-21T21:44:32+00:00"
},
{
"name": "team-reflex/discord-php",
@ -2055,7 +2012,7 @@
"idna",
"punycode"
],
"time": "2016-11-16 10:37:54"
"time": "2016-11-16T10:37:54+00:00"
},
{
"name": "vlucas/phpdotenv",
@ -2105,7 +2062,7 @@
"env",
"environment"
],
"time": "2016-09-01 10:05:43"
"time": "2016-09-01T10:05:43+00:00"
},
{
"name": "voku/anti-xss",
@ -2162,7 +2119,7 @@
"security",
"xss"
],
"time": "2017-04-04 17:07:59"
"time": "2017-04-04T17:07:59+00:00"
},
{
"name": "voku/email-check",
@ -2217,7 +2174,7 @@
"validate-email-address",
"validate-mail"
],
"time": "2016-10-29 13:31:58"
"time": "2016-10-29T13:31:58+00:00"
},
{
"name": "voku/portable-utf8",
@ -2287,7 +2244,7 @@
"utf-8",
"utf8"
],
"time": "2017-04-08 14:24:19"
"time": "2017-04-08T14:24:19+00:00"
},
{
"name": "voku/stringy",
@ -2353,7 +2310,7 @@
"utility",
"utils"
],
"time": "2017-03-09 21:52:59"
"time": "2017-03-09T21:52:59+00:00"
},
{
"name": "voku/urlify",
@ -2411,7 +2368,7 @@
"url",
"urlify"
],
"time": "2017-03-18 04:11:38"
"time": "2017-03-18T04:11:38+00:00"
},
{
"name": "wyrihaximus/react-guzzle-http-client",
@ -2459,7 +2416,7 @@
}
],
"description": "Asyncronous GuzzleRing adapter powered by react/http-client",
"time": "2016-09-24 12:35:05"
"time": "2016-09-24T12:35:05+00:00"
},
{
"name": "wyrihaximus/react-guzzle-psr7",
@ -2504,7 +2461,7 @@
}
],
"description": "Asyncronous Guzzle (PSR7) adapter powered by react/http-client",
"time": "2015-08-09 20:04:16"
"time": "2015-08-09T20:04:16+00:00"
}
],
"packages-dev": [],

Binary file not shown.

View File

@ -16,7 +16,8 @@ class PersistentArray implements \ArrayAccess, \Iterator {
if (!is_file($this->filepath)) throw new Exception("Invalid filepath");
$rawfiledata = file_get_contents($this->filepath);
if (strlen($rawfiledata) > 3) {
$this->data = (new Unpacker())->unpack($rawfiledata);
$this->data = msgpack_unpack($rawfiledata);
// $this->data = (new Unpacker())->unpack($rawfiledata);
}
}
@ -91,7 +92,8 @@ class PersistentArray implements \ArrayAccess, \Iterator {
private function save()
{
file_put_contents($this->filepath, (new Packer())->packMap($this->data));
file_put_contents($this->filepath, msgpack_pack($this->data));
// file_put_contents($this->filepath, (new Packer())->packMap($this->data));
}