Christians Tagebuch PEAR: Search packages in all channels using Pyrus (8.2.2013, 17:02)

Our old and trusted PEAR Installer supports multiple package sources, called "channels", since version 1.4.0 - which was released in 2005. You can host a channel yourself using one of the channel server applications. The most popular one is probably Pirum.

One of the problems with such a distributed network is finding the channel that provides the package you are looking for.

Pyrus, the PHP 5.3+ PEAR installer, has a solution for that:

$ pyrus search mockery
Pyrus version 2.0.0a4 SHA-1: 72271D92C3AA1FA96DF9606CD538868544609A52
Using PEAR installation found at /opt/phpfarm/inst/php-5.3.16/pear
Searching for mockery
1 packages found:
pear.survivethedeepend.com/Mockery

$ pyrus install pear.survivethedeepend.com/Mockery
Pyrus version 2.0.0a4 SHA-1: 72271D92C3AA1FA96DF9606CD538868544609A52
Using PEAR installation found at /opt/phpfarm/inst/php-5.3.16/pear
Sorry, the channel "pear.survivethedeepend.com" is unknown.
Do you want to add this channel and continue?

Please choose: 
  yes
  no
[yes] : 
Discovery of channel pear.survivethedeepend.com successful
Downloading pear.survivethedeepend.com/Mockery
...

Pyrus is able to search all existing channel servers and automatically discover then when they are not known yet.

Technical background

When running pyrus search, it asks the online service pyr.us. This service checks for package releases on the channel servers every night and indexes them.

The list of channel servers that pyr.us uses is fetched from pear.php.net/channels/xbel.php , which is an export of our PEAR channel server list.

So if you want Pyrus to find the packages of your PEAR channel, register your channel on this list.

Link
PHP_CodeSniffer 1.4.4 released (6.2.2013, 23:28)

PHP_CodeSniffer version 1.4.4 has just been uploaded to PEAR and is now available to install. This is primarily a bug fix release although there are a couple of nice new sniff features that some developers may find useful including a new sniff to run CSS Lint on your CSS...

Link
PHP_CodeSniffer 1.4.3 released (4.12.2012, 03:27)

PHP_CodeSniffer version 1.4.3 has just been uploaded to PEAR and is now available to install. This is primarily a bug fix release although support for the upcoming PHP 5.5 T_FINALLY token has been added a few PSR-2 issues have been fixed and a change has been made to improve...

Link
PHP_CodeSniffer general memory improvements (15.11.2012, 04:38)

PHP_CodeSniffer version 1.3.6 introduced memory improvements when using the summary report. You can take a look at the improvements that were reported at the time when running over the Symfony2 codebase. Obviously the summary report is only useful when running PHP_CodeSniffer from the command line and viewing the output...

Link
PHP_CodeSniffer 1.4.1 released (1.11.2012, 23:43)

PHP_CodeSniffer version 1.4.1 has just been uploaded to PEAR and is now available to install. This release includes a few important changes for developers who maintain their own standards and sniffs. Ignore Patterns In version 1.3.6 ignore patterns were changed so that they are checked against the relative path...

Link
PHP_CodeSniffer 1.4.0 released (26.9.2012, 04:42)

PHP_CodeSniffer version 1.4.0 has just been uploaded to PEAR and is now available to install. This release includes two new coding standards; PSR-1 and PSR-2.A lot of effort has gone into compiling these standards from existing sniffs writing new sniffs and making core changes to PHP_CodeSniffer to support new...

Link
Christians Tagebuch Surrogator - free avatar image server (17.8.2012, 22:02)

Avatar for cweiske I hereby announce the release of Surrogator version 0.1.0, a simple Libravatar compatible avatar image server written in PHP.

Libravatar?

You probably know Gravatar, the (proprietary) service by the Wordpress.com guys. You give it the md5 hash of an email address and get an image for it - given that the person owning the email address registered there and uploaded a picture.

Many many blog and web applications use those images to give comments a personal note and make it easy to recognize the commenters.

Libravatar (libre avatar) does basically the same, but has some huge benefits:

  • It is federated, which means that you can host your own avatar server for your domains. In case Libravatar.org or Gravatar are down, images for your email addresses will still be delivered.
  • You can use it as a service like Gravatar if you don't want to host your own server. But unlike Gravatar - which you cannot leave - you have full control over your avatars and your account. Full account export and removal are supported.
  • You can assign images to OpenIDs.
  • It is open source. The Libravatar sources are open for anyone to inspect, improve and install on your own server.
  • It falls back to Gravatar. The userbase of Gravatar is not to be neglected, so Libravatar falls back to the Gravatar image if there is no Libravatar one.
  • You do not have to register another account but may login with your OpenID.

Surrogator?

The original Libravatar software is written in Python and contains the whole package: Profiles, login, image upload, email and OpenID management.

I do not need all that; all I want is to put an image file foo@example.org.png somewhere, and that's it. This is Surrogator.

Just download (or git clone) Surrogator, follow the 4 setup steps, put the image files in the raw/ directory and that's it. It just works and takes little server resources.

Services_Libravatar

So Libravatar is cool, how can you use it? Luckily, Melissa Draper wrote the Services_Libravatar library which is documented and easily installable via PEAR or Pyrus:

$ pear install services_libravatar-alpha

Using it is as easy as writing four lines of code:

getUrl('foo@example.org');
echo 'Avatar';

That's it. Now start using free avatar images in your software, and use one of the available plugins.

Link
Christians Tagebuch PHP_CodeSniffer: notify-send report (14.8.2012, 16:22)

I use emacs as IDE, and wanted to have direct feedback about the validity of my .php files when writing them. The most easy way was to add a save hook that runs PHP_CodeSniffer - but the results should be displayed in a nice, unobtrusive way.

phpcs has multiple reporting modes - xml, checkstyle, csv etc. - but nothing for the desktop. I thought that notify-send would be the right fit since it is able to display pretty popup messages without getting in the way.

So I hacked a bit and send a pull request to Greg that got merged today. So in the next version of PHP_CodeSniffer, you will be able to enjoy it, too!

So when running

$ phpcs --report=notifysend file.php

you will see something along this:

phpcs error phpcs ok

emacs integration

The integration into emacs is pretty simple. Just put the following into your .emacs file:

(defun phpcs-notifysend()
  "Performs a PHP code sniffer check on the current file and shows a
popup message." (interactive)
  (start-process-shell-command
   "phpcs" nil
   (format "phpcs --standard=TYPO3 --report=notifysend \"%s\""
           (buffer-file-name))
  )
)

Using M-x phpcs-notifysend, you'll run the check immediately. Running it automatically when a file gets saved isn't hard either:

(defun phpcs-notifysend-hook ()
  (when (string-match "\.php$" buffer-file-truename)
    (phpcs-notifysend)))
(add-hook 'after-save-hook 'phpcs-notifysend-hook)

Alternatives

Hans-Peter Buniat told me about his tool Testy which runs unit tests and has many options to notify you about the results - including notify-send, dbus and Growl. It could be started from within emacs, too.

Link
PHP_CodeSniffer memory improvements to summary report (24.7.2012, 05:01)

Memory is the first thing to run out during a really big PHP_CodeSniffer run when a large number of errors and warnings are generated. The reason for this is pretty simple; PHP_CodeSniffer keeps the errors and warnings in memory so it can print consolidated error reports at the end...

Link
PHP_CodeSniffer 1.3.5 released (12.7.2012, 05:18)

PHP_CodeSniffer version 1.3.5 has just been uploaded to PEAR and is now available to install. This release has been focused primarily on bug fixing. In particular a number of bugs affecting Windows users have been resolved and all Windows users are encouraged to upgrade to this new version. Special...

Link
Links RSS 0.92   RDF 1.
Atom Feed  
PHP5 powered   PEAR
Link the Planet <a href="http://www.planet-pear.org/">Planet PEAR</a>