From e498534e3fc30362d3bfbed7dbef4aab75fcca25 Mon Sep 17 00:00:00 2001 From: altername Date: Tue, 5 Jul 2022 11:08:30 +0300 Subject: [PATCH] update docs --- README.md | 23 +++--- composer.json | 6 +- composer.lock | 207 +++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 220 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index bd8a84c..08742ac 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,15 @@ SQS Client For starting use SQS Client we need to create a connection to the server like this. Create an instance of SQS and use 2 methods - setConnectionProperties() connect(). -$connection = new SQS; -$connection->setConnectionProperties(array $properties); +$connection = SQS::obj(); +$connection->declareConnection(array $properties, \Memcrab\Log\Log $ErrorHandler); $connection->connect(); -Method setConnectionProperties(array $properties) - you must get region, credentials from your profile ($key and $secret), version, +Method declareConnection(array $properties, \Memcrab\Log\Log $ErrorHandler) - you must get region, credentials from your profile ($key and $secret), version in first argument and Log::obj() in second, for example: -$connection->setConnectionProperties(['region' => 'us-west-2', 'key' => 'your_aws_access_key_id', 'secret' => 'your_aws_secret_access_key', 'version' => '2022-11-05']); +$connection->setConnectionProperties(['region' => 'us-west-2', 'key' => 'your_aws_access_key_id', 'secret' => 'your_aws_secret_access_key', 'version' => '2022-11-05'], Log::obj()); Next we must declare a queue: @@ -52,7 +52,7 @@ $connection->changeMessageVisibility('queue_name', ['messages'], 10), where 10 - To check connection: -$connection->connectionStatus(); +$connection->ping(); To get list of all queues: @@ -94,17 +94,16 @@ RabbitMQ Client --------------- For starting use RabbitMQ Client we need to create a connection to the server like this. Create an instance of RMQ and use 2 methods - -setConnectionProperties() and connect(). +declareConnection() and connect(). -$connection = new RMQ; -$connection->setConnectionProperties(array $properties); +$connection = RMQ::obj(); +$connection->declareConnection(array $properties, \Memcrab\Log\Log $ErrorHandler); $connection->connect(); -Method setConnectionProperties(array $properties) - you must get hostname, port, username and password, -for example: +Method declareConnection(array $properties, \Memcrab\Log\Log $ErrorHandler) - you must get hostname, port, username and password in first argument and Log::obj() in second, for example: -$connection->setConnectionProperties(['host' => 'localhost', 'port' => '5672', 'username' => 'guest', 'password' => 'guest']); +$connection->declareConnection(['host' => 'localhost', 'port' => 5672, 'username' => 'guest', 'password' => 'guest'], Log::obj()); Next the library will create a channel and we must declare a queue: @@ -137,7 +136,7 @@ $connection->registerExchange('exchange_name', 'direct', true, true, false); To check connection: -$connection->connectionStatus(); +$connection->ping(); To send message: diff --git a/composer.json b/composer.json index cc92089..16c1c43 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,9 @@ "require": { "php": ">=8.0", "aws/aws-sdk-php": "^3.225", - "php-amqplib/php-amqplib": "^3.2" + "php-amqplib/php-amqplib": "^3.2", + "monolog/monolog": "^3.1", + "memcrab/log": "^2.1" }, "require-dev": { "phpunit/phpunit": "9.*.*" @@ -33,4 +35,4 @@ "Memcrab\\Queue\\": "src/" } } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index c7ab2e4..3ce0b92 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cb9b6c21bd52995b9e2c87a1cadb44ff", + "content-hash": "4519a415e02af103fe5bd660636731c4", "packages": [ { "name": "aws/aws-crt-php", @@ -470,6 +470,159 @@ ], "time": "2022-06-09T08:26:02+00:00" }, + { + "name": "memcrab/log", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/Memcrab/Log.git", + "reference": "8938691d8dfe26ab9a159075143bf95ce034a7e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Memcrab/Log/zipball/8938691d8dfe26ab9a159075143bf95ce034a7e9", + "reference": "8938691d8dfe26ab9a159075143bf95ce034a7e9", + "shasum": "" + }, + "require": { + "monolog/monolog": "3.1.0", + "php": ">=8.0" + }, + "require-dev": { + "phpunit/phpunit": "9.*.*" + }, + "type": "package", + "autoload": { + "psr-4": { + "Memcrab\\Log\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oleksandr Diudiun", + "email": "a.diudiun@gmail.com" + } + ], + "description": "Additional static layer for monolog lib", + "homepage": "http://memcrab.com", + "keywords": [ + "log", + "monolog", + "php" + ], + "support": { + "issues": "https://github.com/Memcrab/Log/issues", + "source": "https://github.com/Memcrab/Log/tree/2.1.0" + }, + "time": "2022-07-04T09:08:49+00:00" + }, + { + "name": "monolog/monolog", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "0c375495d40df0207e5833dca333f963b171ff43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/0c375495d40df0207e5833dca333f963b171ff43", + "reference": "0c375495d40df0207e5833dca333f963b171ff43", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/log": "^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2", + "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "php-console/php-console": "^3.1.3", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^9.5.16", + "predis/predis": "^1.1", + "ruflin/elastica": "^7", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/3.1.0" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2022-06-09T09:09:00+00:00" + }, { "name": "mtdowling/jmespath.php", "version": "2.6.1", @@ -998,6 +1151,56 @@ }, "time": "2016-08-06T14:39:51+00:00" }, + { + "name": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", @@ -2277,7 +2480,7 @@ } }, "autoload": { - "classmap": [ + "classmap": [ "src/" ] },