Can You Build a CLI Image Drawing Laravel App with These Packages?

Bruno Skvorc

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

laracademy/interactive-make [216 ★]

Laravel Interactive Make is a plugin that lets you use Laravel’s make command interactively, without being verbose about exactly what it is you want to generate, as the following gif demonstrates:

Gif of Laravel Interactive Make in action

The tool will ask you about commands and sub-commands until you reach a point at which you’re happy with what got generated. No more looking up make commands!

There’s some issues to take care of, so get to helping!

reibengu/laravel-auto-validation [45 ★]

This package will let you remove all manual validation from Laravel Controllers, and instead rely on automatic validation that kicks instantly into action as a given controller and method are called – all you need to do is use the package’s trait in a controller, and set the service provider. Then, you define rules like so:

$rules = [
    'UserController' => [
        'register' => [
            'name'     => 'required|max:255',
            'email'    => ['required', 'email', 'max:255', Rule::unique('users')->where('status', 1)],
            'password' => 'required|min:6|confirmed',
            'gender'   => 'required|in:male,female',
            'birthday' => 'required|date_format:Y-n-j',
        'update' => function ($request) {
            return [
                'name'     => 'required|max:255',
                'email'    => 'required|email|max:255|unique:users,email,'.$request->user()->id,
                'gender'   => 'required|in:male,female',
                'birthday' => 'required|date_format:Y-n-j',

return ['rules' => $rules];

The remainder of the process is automatic, and if validation fails, the request is automatically redirected back to the page from where it came, with error messages about validation flashed into session.

The project has no outstanding issues or pull requests, but why not add some? Here’s an idea: make it dead easy to customize these error messages, and integrate them with Laravel’s translator.

delight-im/PHP-PrivacyPolicy [26 ★]

In what’s a somewhat oddball case, PHP-PrivacyPolicy is a tool which programmatically generates a privacy policy and related documents for apps and digital tools and resources, in both human readable and machine oriented form.

Go ahead and add another paragraph or two you think might be needed one day, or even turn it into a SaaS and let people generate the policies online.

ozh/git-score [7 ★]

Inspired by the Python-based git-score, this command-line installable tool can be executed inside cloned repos on your machine in order to calculate information about contributors, and assign scores to all the people involved.

Here’s an example output, as taken from their README:

$ git score
name              commits  delta    (+)    (-)  files
Ozh                  2230  47906  66188  18282    500
Léo Colombaro         145   1038  15438  14400     84
lesterchan             43    553   1366    813     24
Nic Waller             13    322    434    112      5 Labs         12     10     21     11      4
Preovaleo              11     -5     28     33      7
Clayton Daley           9     13     29     16      2
Diftraku                8      0     16     16      8
Audrey                  4     10     21     11      4

No outstanding issues or PRs, but it would probably be fun to upgrade it with some extra stats to track – for example, a console based render of the activity for each user, similar to the activity graph on would be quite cool.

banago/PHPloy [1,119 ★]

PHPloy, deserves a mention here despite being quite a popular package already. PHPloy solves a very familiar pain point in deploying via (S)FTP, where users seldom know exactly which files they had changed, so they often opt to just re-upload the whole project. At the beginning, this doesn’t really matter, but as the project grows, the complexity of incremental updates grows exponentially with it, and why would one waste time on this when it’s so easy to use Git’s existing functionality to do it?

PHPloy detects changes between commits and only pushes the changed files online. It supports multiple servers, submodules, and rollbacks.

joseluisq/gimage [112 ★]

Gimage, another issue and PR-free package, is a tool for fluent building of images with PHP and the native GD library (extension).

Gimage provides a fluent interface for editing and drawing images and is little more than a very natural-sounding human-readable abstraction around GD’s native methods.

For example, here’s how to draw a green ellipse:

use GImage\Figure;

// Setting ellipse sizes
$ellipse = new Figure(500, 300);
    // Set ellipse type
    // Setting a green RGB color
    ->setBackgroundColor(170, 188, 147)
    // Creating the figure
    // Outputting image (PNG Figure by default) on the browser.

And here’s how to draw this image:

Example image made by Gimage


use GImage\Image;
use GImage\Text;
use GImage\Figure;
use GImage\Canvas;

$avatar_image = new Image();

    ->setColor(204, 164, 116)

$twitter_text = new Text('@username');
    ->setColor(130, 127, 125)

$canvas_figure = new Figure(550, 250);
    ->setBackgroundColor(47, 42, 39)

$avatar_box = new Figure($avatar_image->getWidth() + 16, $avatar_image
    ->getHeight() + 17);
    ->setBackgroundColor(63, 56, 52)
    ->setLeft($avatar_image->getLeft() - 7)
    ->setTop($avatar_image->getTop() - 8)

$avatar_box2 = new Figure($avatar_image->getWidth() + 3, $avatar_image
    ->getHeight() + 19);
    ->setBackgroundColor(79, 72, 67)
    ->setLeft($avatar_image->getLeft() + 7)
    ->setTop($avatar_image->getTop() - 9)

$avatar_box3 = new Figure(120, 240);
    ->setBackgroundColor(63, 56, 52)

$line_vertical = new Figure(600, 10);
    ->setBackgroundColor(119, 99, 77)

$line_horizontal = new Figure(1, 240);
    ->setBackgroundColor(79, 72, 67)

$canvas = new Canvas($canvas_figure);

Further examples can be seen here.

The library needs more usage examples, so get to it!

That’s it for May. 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!

Like last time, (that challenge remains unclaimed, by the way – there’s $500 in it for you if you do it!), we’re using the above packages for inspiration on creating a potentially useful app or two:

App+Tutorial idea(s) of the month:

  • an app which uses interactive make to add a new “draw image” command, and interactively asks the user about the kind of image to draw, using Gimage. The user’s input should be validated with auto-validation.
  • or, an app which lets people generate privacy policies interactively with PHP-PrivacyPolicy, and is deployed with PHPloy – a tutorial around all that.

Get in touch to find out how much these are worth to us!

Happy coding!