From 045dd1b88f715d94904bca3c15456e51dd3147f4 Mon Sep 17 00:00:00 2001 From: Pablo del Vecchio Date: Wed, 9 May 2018 15:48:10 +0200 Subject: [PATCH] changed composer --- composer.json | 11 +++--- src/SimpleMongo.php | 93 --------------------------------------------- 2 files changed, 5 insertions(+), 99 deletions(-) delete mode 100644 src/SimpleMongo.php diff --git a/composer.json b/composer.json index 5d0b8e5..9b9ccde 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "dvpablo/php-picnic", - "description": "Picnic (Simple) PHP libraries to connect to persistent layers like Cassandra, Couchbase, Couchdb, Mongo, ElasticSearch, Kinesis, Mysql and AWS S3.", - "version": "0.2.2", + "description": "Picnic (Simple) PHP libraries to connect to persistent layers like Cassandra, Couchbase, Couchdb, ElasticSearch, Kinesis, Mysql and AWS S3.", + "version": "0.3.1", "authors": [ { "name": "Pablo del Vecchio", @@ -14,10 +14,9 @@ } }, "require": { - "php": ">=5.6.0", - "aws/aws-sdk-php": "2.*", - "elasticsearch/elasticsearch": "2.*", - "mongodb/mongodb": "1.*" + "php": ">=7.0.0", + "aws/aws-sdk-php": "*", + "elasticsearch/elasticsearch": "*" }, "autoload": { "psr-4": { diff --git a/src/SimpleMongo.php b/src/SimpleMongo.php deleted file mode 100644 index f6147f1..0000000 --- a/src/SimpleMongo.php +++ /dev/null @@ -1,93 +0,0 @@ -params = $params; - - try { - $this->client = new MongoDB\Client($params['uri']); - - if ($database) { - $this->client->selectDatabase($database); - } - - } catch (Exception $e) { - return $e->getMessage(); - } - - return $this; - } - - public function listDatabases() - { - try { - $databases = $this->client->listDatabases(); - - foreach ($databases as $database) { - $d['name'] = $database->getName(); - $d['size_on_disk'] = $database->getSizeOnDisk(); - - $arDatabases[] = $d; - } - - } catch (Exception $e) { - echo $e->getMessage(); - } - - return $arDatabases; - } - - public function listCollections($database) - { - try { - $db = $this->client->selectDatabase($database); - $collections = $db->listCollections(); - - foreach ($collections as $collection) { - $c['name'] = $collection->getName(); - - $arCollections[] = $c; - } - } catch (Exception $e) { - echo $e->getMessage(); - } - - return $arCollections; - } - - public function collectionCount($collection) - { - try { - $count = $collection->count(); - - } catch (Exception $e) { - echo $e->getMessage(); - } - - return $count; - } - - public function getOneByAttVal($database, $collection, $att, $val) - { - try { - $doc = $this->client->$database->$collection->findOne([$att => $val]); - - } catch (Exception $e) { - echo $e->getMessage(); - } - - return $doc; - } -}