GithubHelp home page GithubHelp logo

php-amqp's Introduction

PHP AMQP bindings Build Status

Object-oriented PHP bindings for the AMQP C library (https://github.com/alanxz/rabbitmq-c)

Requirements:

Installation

Some systems has php-amqp extension in their repo or available via external repositories, so it is MAY be the preferable way to install.

If you want to stay on the bleeding edge and have the latest version, install it from PECL or compile from sources (follow PHP official docs instruction).

Documentation

stub files with accurate PHPDoc which may be also used in your IDE for code completion, navigation and documentation in-place.

Notes

  • Max channels per connection means how many concurrent channels per connection may be opened at the same time (this limit may be increased later to max AMQP protocol number - 65532 without any problem).

  • Nested header arrays may contain only string values.

Persistent connection

Limitations:

  • there may be only one persistent connection per unique credentials (login+password+host+port+vhost). If there will be attempt to create another persistent connection with same credentials, exception will be thrown.
  • channels on persistent connection are not persistent: they are destroyed between requests.

Alternatively to built-in persistent connection support raphf pecl extension may be used.

How to report a problem

  1. First, search through the closed issues and stackoverflow.com.
  2. Submit an issue with short and definitive title that describe your problem
  3. Provide platform info, php interpreter version, SAPI mode (cli, fpm, cgi, etc) extension is used in, php-amqp extension version, librabbitmq version, make tools version.
  4. Description should provide information how to reproduce a problem (gist is the most preferable way to include large sources) in a definitive way. When special environment Vagrant may be in handy.
  5. If stack trace generated include it in full via gist or the important part (if you are definitely know what you are doing) directly in description.
Things to check before reporting a problem

Some of them, the list is not complete.

  1. You are running on correct machine in correct environment and you platform meet your application requirement.
  2. librabbimq installed and discoverable in your environment so php-amqp extension can load it.
  3. php-amqp extension present in system (find amqp.so or amqp.dll if you are on windows), it is loaded (php --ri amqp produced some info), and there are no underlying abstraction that MAY emulate php-amqp work.
  4. You has correct RabbitMQ credentials.
  5. You are using the latest php-amqp, librabbitm, RabbitMQ and sometimes PHP version itself. Sometimes your problem is already solved.
  6. Other extensions disabled (especially useful when PHP interpreter crashes and you get stack trace and segmentation fault).
Development

There are vagrant environment with pre-installed software and libraries necessary to build, test and run php-amqp extension.

To start it, just type vagrant up and then vagrant ssh in php-amqp directory.

Services available out of the box are:

Additional tools are pre-installed to make development process as simple as possible:

  • valgrind is ready to help find memory-related problems if you export TEST_PHP_ARGS=-m before running tests

  • phpbrew waits to help you test extension on various PHP versions. phpbrew install 5.6 +debug+default+fpm is a nice start. To switch to some version just use phpbrew switch <version>.

    To start php-fpm just run phpbrew fpm start (don't forget to run sudo service stop php5-fpm befor).

    This development environment out of the box ready for php-fpm and cli extension usage, if need to test it when php used as apache module, refer to Apache2 support on phpbrew wiki. Keep in mind that +apxs2 conficts with +fpm and it is a bit tricky to specify which libphp .so will be loaded.

Keeping track of the workers

It is a good practice to keep php processes (i.e workers/consumers) under control. Usually, system administrators write their own scripts which ask services about current status or performs some desired actions. Usually request is sent via UNIX signals.
Because amqp consume method is blocking, pcntl extension seems to be useless.

php-signal-handler extension uses signal syscall, so it will work even if blocking method was executed. Some use cases are presented on extension's github page and examples are available here.

php-amqp's People

Contributors

aleskiontherun avatar bkw avatar coodix avatar dkreuer avatar dmitry-vinogradov avatar empi89 avatar guilhermeblanco avatar kinncj avatar lstrojny avatar lyrixx avatar narkq avatar pdezwart avatar pinepain avatar siad007 avatar sqmk avatar vkartaviy avatar weltling avatar wilfrem avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.