Sourcehunt 17.1: 7 Interesting PHP Packages to Keep an Eye OnBy Bruno Skvorc
Could it be this is only this year’s first sourcehunt? Seems longer, especially given what’s on offer this time around, but ¯_(ツ)_/¯
More from this author
If you’re new to Sourcehunt, it’s our monthly post for promoting open source projects that seem interesting or promising and could use help in terms of Github stars or pull requests. It’s our way of giving back – promoting projects that we use (or could use) so that they gain enough exposure to attract a wider audience, a powerful community and, possibly, new contributors or sponsors.
Without further ado, let’s dive into this month’s offering.
dannyvankooten/vat.php [162 ★]
As per their documentation:
vat.php is a simple PHP library which helps you to deal with European VAT rules. It helps you…
- Grab up-to-date VAT rates for any European member state
- Validate VAT numbers (by format or existence)
- Work with ISO 3166-1 alpha-2 country codes and determine whether they’re part of the EU.
- Geolocate IP addresses
- The library uses jsonvat.com to obtain its data for the VAT rates.
The library is little more than an API proxy to jsonvat.com, with added utility functions. However, those utility functions and the ease of use of this lib make it a valuable addition to any e-commerce site’s vendor directory. It even supports checking general country data, like so:
$countries = new DvK\Vat\Countries(); $countries->all(); // array of country codes + names $countries->name('NL') // Netherlands $countries->europe(); // array of EU country codes + names $countries->inEurope('NL'); // true $countries->ip('126.96.36.199'); // US
Microsoft/tolerant-php-parser [210 ★]
Microsoft? Do they really need promotion/help? Well, due to the nature of the package and its implied usefulness, I vote yes.
Tolerant PHP Parser is intended for use with IDEs to check the code by generating an AST (abstract syntax tree). Two main qualities (or planned qualities, as it’s very early still) are the fact that it is error tolerant, so doesn’t return a fully broken AST when incomplete code is detected (by default, most code in an IDE will be incomplete because it’s in the process of being written), and the fact that it is written in PHP but built with IDEs in mind. The latter is especially handy because it lets the PHP community itself contribute to a parser that verifies their own code, and works on a bunch of IDEs out of the box, rather than waiting for the dev team of a particular IDE to apply a fix.
The tool is in active development, and the team are looking for help with getting it to its final form – this is not a one-off experiment package that’ll be abandoned as soon as the author gets a new gig. This is a dedicated tool with loads of potential, and it deserves our attention. Check it out!
php-enqueue/enqueue-dev [103 ★]
Enqueue is an “enterprise queue system” for PHP. From the very first glance, it’s quite obvious that the author means serious business with this package – the development repository is where all development happens. Production versions are published separately as read only, containing subsets of what was developed in the development repo.
We’ve dealt with queues quite a bit here at SitePoint, but always with a specific implementation for a specific purpose. What Enqueue offers is a no-nonsense abstracted queueing package with multiple protocols supported out of the box, and applicable to any framework, app, or CMS. For Symfony fans, a bundle is provided out of the box, but it’s in no way a Symfony-only thing.
If you’re not familiar with queues, it’s a bit hard to explain in a few short paragraphs, so I recommend you read the quick tour and well written docs here.
The repo has some (at first glance) relatively easily solvable issues, so if you’re feeling up to it go and get your contribution score up, and if you’d like to give it a spin don’t forget to ping us – we’d love to pay you for a tutorial and help the library with more exposure that way.
vimeo/psalm [243 ★]
Another big name product, Psalm is a static analyzer for PHP in the spirit of Phan and others which will analyze your PHP code as your write it (or on demand) and output some discrepancies and errors it may have found.
There’s not much more to say other than that it’s dead easy to use, and is an ongoing development project that would welcome your help. Go check it out!
waxim/vouchers [43 ★]
Vouchers is a library for creating and validating vouchers.
Need to generate a discount code for an online product? A code for accessing a shared file? A promo code for referral tracking? Voucher can help.
The library makes no assumptions about storage, meaning they don’t care about how you do it – the authors don’t force any particular storage mechanism down your throat, which makes the whole thing that much more powerful and universally applicable.
There are no issues to help out with at the time of this writing, but they could use help with documentation and a tutorial or two, so if you’re feeling up to it, we’ve got the budget to cover you!
Short and to the point – this package lets you “send” emails from your Laravel app to your local hard drive. Whether that’s for static-file backup purposes, or HTML previews that can easily be version controlled and forwarded to QA, doesn’t matter.
There are some minor issues that need taking care of (mainly Laravel version compatibility things), the package not really being brand new, but all in all it’s production-ready and just needs tutorials and more examples.
Perhaps you can even think of a feature or two to add?
A library providing math and statistics operations for numbers of arbitrary size
Sound familiar? Maybe because of this? Yes, there are some other libraries taking care of some of this, but that doesn’t mean there’s no room for innovation – every new player brings some insight to the table, and this nifty modern library is, in fact, quite mature and stable.
I’ll be demoing this library in a project soon, but in the meanwhile, before diving in, please keep in mind the following caveat:
This library implements certain constants (Pi, Tau, Euler’s Number, and the Golden Ratio) as hardcoded constants out to 100 digits. Because many of the functions it performs (such as logarithms and trigonometry functions) depend on these constants, this library is not actually truly arbitrary precision. Instead, you can work with numbers that are accurate out to 100 decimal places, and you can calculate trigonometry functions out to 99 decimal places.
That’s it for January. Found anything you could sink your teeth into?
As always, please throw your links at us with the #sourcehunt hashtag! If you build something with the projects we’ve mentioned, or if you submit an elaborate pull request you’d like to talk about, give us a shout and we’ll make sure the world knows about it!