• Home
  • blog
  • Sourcehunt – Build a Medium Exporter + Cool New Libs!

Sourcehunt – Build a Medium Exporter + Cool New Libs!

It’s time for our monthly hunt for new open source libraries to use and contribute to!

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.

Sourcehunt logo

We’ve had a lot of fantastic submissions this month, so let’s dive in!

rethinkphp/json-validator [28 ★]

A Json Validator that designed to be elegant and easy to use.

Made by the author of the Blink framework, json-validator’s only purpose is to make sure a data structure conforms to the pre-defined specification. It currently supports int, double, bool, string, number, array, and object, but also lets you define fully custom types, like so:

$validator->defineType('User', [
    'name' => 'string',
    'gender' => 'string',
    'age' => '?integer',

You can also define them in callables:

$validator->defineType('timestamp', function ($value) {
    if ((!is_string($value) && !is_numeric($value)) || strtotime($value) === false) {
        return false;

    $date = date_parse($value);

    return checkdate($date['month'], $date['day'], $date['year']);

The library is very new and could use contributions – everything from the docs to features needs work, so it’s a great opportunity to contribute.

Nerdmind/Blog [20 ★]

This minimalistic and mobile-friendly blogging engine, while leaving much to be desired in the visual department, is a practical quick-fix for anyone looking to start a blog without the baggage of larger system weighing them down.

It does seem somewhat like a learning experience for the author, so why not jump in, identify some issues (lots of antipatterns right off the bat), and maybe fix some while you’re at it? Perhaps both of you can learn from the experience.

violet-php/streaming-json-encoder [125 ★]

This streaming JSON encoder lets you process and send large JSON files without hitting the memory limit. As described in the README:

Streaming JSON Encoder is a PHP library that provides a set of classes to help with encoding JSON in a streaming manner, i.e. allowing you to encode the JSON document bit by bit rather than encoding the whole document at once. Compared to the built in json_encode function, there are two main advantages:

  • You will not need to load the entire data set into memory, as the encoder supports iterating over both arrays and any kind of iterators, like generators, for example.
  • You will not need to load the entire resulting JSON document into the memory, since the JSON document will be encoded value by value and it’s possible to output the encoded document piece by piece.

It also provides a PSR-7 compatible stream for those kinds of frameworks.

The package could use more tutorials, tests, and usage examples, so get on it if you’re eager – we’ll pay!

dsentker/phpinsights [2 ★]

This simple but effective wrapper around Google PageSpeed Insights is incredibly useful for testing pipelines when you want to track your pagespeed score across time or commit.

$uri = '';
$caller = new PhpInsightsInsightsCaller('your-google-api-key-here', 'de');
$response = $caller->getResponse($uri, PhpInsightsInsightsCaller::STRATEGY_MOBILE);
$result = $response->getMappedResult();

var_dump($result->getSpeedScore()); // 100 
var_dump($result->getUsabilityScore()); // 100 

Note that you need to get an API key from the Google Dev console before you can use it.

Right now, it needs more tests, so if your TDD-fu is weak, here’s a chance to refresh it!

lazychaser/laravel-nestedset [847 ★]

A fairly popular library already, laravel-nestedset provides Laravel users with a very approachable and incredibly versatile solution to working with nested sets.

As the repo states, it is a way to effectively store hierarchical data in a relational table, and shows good performance when tree is updated rarely. It is tuned to be fast for getting related nodes and ideally suited for building multi-depth menus or categories for shops.

The library is feature-rich, including but not limited to reversed tree retrieval, appending and prepending to any parent level, dealing with siblings, flattening, and more.

Right now, it has 15 issues that need attention – go and give them a hand if you can, will you?

Continue reading %Sourcehunt – Build a Medium Exporter + Cool New Libs!%