PEAR - PHP Extension and Application Repository Packagist 24 Cool PHP Libraries You Should Know About Martin Angelov It is an exciting time to be a PHP developer. There are lots of useful libraries released every day, and with the help of Composer and Github, they are easy to discover and use. Here are 24 of the coolest that I’ve come across. 1. Dispatch is a minimal PHP framework. include 'dispatch.php'; get('/greet', function () { render('greet-form'); }); post('/greet', function () { $name = from($_POST, 'name'); render('greet-show', array('name' => $name)); }); dispatch(); You can match specific types of HTTP requests and paths, render views and more. 2. Klein is another light weight routing library for PHP 5.3+. respond('/[:name]', function ($request) { echo 'Hello ' . You can also subscribe to specific HTTP methods and use regexes as paths: This is great for small projects, but you have to be disciplined when using a library like this for larger apps, as your code can become unmaintainable very fast. 3. require '.. 4. Assetic is am asset management framework for PHP. 5. 6. 7. 8. 9.
PHP algorithms: Determining if an IP is within a specific range. « Paul Gregg I spend a lot of time lurking in the #PHP channel (efnet and freenode, please – no flamewars) and this topic is a commonly asked one that usually gets a simplified answer in the form of using strpos(), or at best an ip2long() in a greater than and less than answer. Unfortunately although people usually understand that an IP address is simply an unsigned 32 bit integer, and is easily determined, usually with $_SERVER['REMOTE_ADDR'], where the real challenge is – is in specifying the range within which they wish to check that IP address. IP ranges are usually specified in three common ways (in increasing complexity): Wildcard: 192.168.10. The Wildcard method, or “classy”, allows you to work at Class A (10.*.*.*), Class B (172.16.*.*) or Class C (192.168.10.*) levels of granularity which is how we used to do things in the old days (before the Web decided to make the Internet popular). Thus was born CIDR (yes, I’m skipping talking about Start-End ranges for now). Again, correct.
PHP: Hypertext Preprocessor PHP Best Practices: a short, practical guide for common and confusing PHP tasks Doctrine-Project