Download the PHP package memcrab/queue without Composer

On this page you can find all versions of the php package memcrab/queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package queue

Config Libriary for php 8.0 core package

Install

require_once DIR . "/needle_path/vendor/autoload.php";

use Memcrab\Queue; use Memcrab\Queue\SQS; use Memcrab\Queue\RMQ;

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->connect();

Method setConnectionProperties(array $properties) - you must get region, credentials from your profile ($key and $secret), version,
for example:

$connection->setConnectionProperties(['region' => 'us-west-2', 'key' => 'your_aws_access_key_id', 'secret' => 'your_aws_secret_access_key', 'version' => '2022-11-05']);

Next we must declare a queue:

$connection->registerQueue('queue_name');

The method also have optional parameter $attibutes - array, where we can use:

If we need to change message's visability, we can use:

$connection->changeMessageVisibility('queue_name', ['messages'], 10), where 10 - needle visibility timeout.

To check connection:

$connection->connectionStatus();

To get list of all queues:

$connection->getListOfQueues();

To send message:

$connection->sendMessage('queue_name', [message_body]);

We can add optional parameters:

To receive message:

$connection->receiveMessage('queue_name');

To delete message fron queue:

$connection->deleteMessage('queue_name', ['message']);

To get queue's url:

$connection->getQueueUrl('queue_name');

If you need close connection, use:

$connection->shutdown();

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().

$connection = new RMQ; $connection->setConnectionProperties(array $properties); $connection->connect();

Method setConnectionProperties(array $properties) - you must get hostname, port, username and password, for example:

$connection->setConnectionProperties(['host' => 'localhost', 'port' => '5672', 'username' => 'guest', 'password' => 'guest']);

Next the library will create a channel and we must declare a queue:

$connection->registerQueue('queue_name');

The method also have optional parameters like:

$connection->registerQueue('queue_name', false, true, false, false);

Also we can create an exchange like:

$connection->registerExchange('exchange_name', 'direct');

The method also have optional parameters like:

$connection->registerExchange('exchange_name', 'direct', true, true, false);

To check connection:

$connection->connectionStatus();

To send message:

$connection->sendMessage('queue_name', [message_body]);

You can create third parameter - 'exchange_name', if you need it.

To receive message:

$connection->receiveMessage('queue_name');

The method also have optional parameters like:

$connection->receiveMessage('queue_name', 'consumer_tag', true, false, true, 'my_function');

If you need to tell the exchange to send messages fron the queue, we can create the relationship between them like this:

$connection->queueBind('queue_name', 'exchange_name', 'routing_key');

If you need close channel and connection, use:

$connection->shutdown();


All versions of queue with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
aws/aws-sdk-php Version ^3.225
php-amqplib/php-amqplib Version ^3.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package memcrab/queue contains the following files

Loading the files please wait ....