📜 ⬆️ ⬇️

New PHP extension under the old name: event

In PECL, they somehow stopped supporting extensions for libevent . In particular, libevent version 2 was not supported by either the libevent extension of the same name, nor the event extension (the last release was in 2004). Therefore, it was decided to rewrite the extension “event”, which had been lost since 2004.

Thus, event is an old extension in a new guise:



The transition to the OO API is due to the fact that the original names of the functions in libevent are not particularly beautiful:
')
bufferevent_setcb bufferevent_setwatermark bufferevent_socket_get_dns_error evbuffer_add_buffer evbuffer_get_contiguous_space 

etc.

In addition, a member of the core PHP team, Johannes SchlĂĽter, assured that resources are practically no gains in performance compared to objects, and sometimes even lose. In general, recently there has been a tendency to move to objects.

Documentation

http://docs.php.net/manual/en/intro.event.php . Examples are there in the “Examples” section.

Installation

$ sudo pecl install event-beta
$ sudo pecl install event

The extension is being actively tested on Gentoo, Fedora, Ubuntu and FreeBSD. While from time to time there is a need for corrections and additions, the code remains in the beta version.

I hope it will be useful to someone.

Thank.

UPDATE

Stable release 1.5.0 is available.

PS

Used in the phpDaemon project.

Source: https://habr.com/ru/post/172699/


All Articles