Posts tagged with github

Manage newsletters in Laravel 5

by Freek Van der Herten – 1 minute read

A few hours ago I tagged version 1.0.0 of a my new package: laravel-newsletter. It provides a very easy way to interact with email marketing services. Or maybe I should simply say MailChimp, as it is currently the only supported supported service. After you install the package (un)subscribing an…

Read more

Join thousands of developers

Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.

No spam. Unsubscribe anytime. You can also follow me on X.

A Laravel package to retrieve Google Analytics data

by Freek Van der Herten – 1 minute read

If you need to retrieve some data from your Google Analytics account in Laravel 5, then laravel-analytics is the package for you. Assuming the analytics tracking code is installed on your site, the package allows you to determine which pages are visited the most, which browsers are used most to…

Read more

Add a command to dump your database in Laravel 5

by Freek Van der Herten – 1 minute read

This Laravel 5 package provides an artisan command to dump your database to a file. When installed you can dump your database with this command [code]php artisan db:backup``` A file containing the dump of your database will be created in the directory you specified in the config-file. I plan on…

Read more

Building Gistlog

Matt Stauffer shows how he built Gistlog in under two hours.

Gistlog is a blogging "platform" for people who want to quickly write and publish content, in Markdown, and don't want to bother with yet another platform and yet another login and yet another group hoarding their content. With Gistlog, you use your pre-existing Github login, you store the data in your own Github account, and you can publish with a single click.
A must see if you want to know how to get things done quickly in Laravel.

https://www.youtube.com/watch?v=g4BbeHYCR1E

Also make sure you check out his blogposts on the new features of Laravel 5.

Read more

Some Laravel 5 compatible packages

Recently some of the Laravel-packages I built at Spatie were updated for Laravel 5.

spatie/laravel-glide This package enables you to generate image manipulations on the fly and generate URL's to those images. These URL's will be signed so only you will be able to specify which manipulations should be generated. Every manipulation will be cached. Under the hood, Glide is being used.

spatie/searchindex This is an opinionated package to store and retrieve objects from Elasticsearch. It was tailormade for a project I was working on and only provides the functionality that I needed. If you need full control over elasticsearch via PHP, take a look at the official low-level client.

spatie/googlesearch This package can fetch results from a Google Custom Search Engine. It returns an array with searchresults.

eloquent-sortable This package provides a trait that adds sortable behaviour to an Eloquent model. The value of the ordercolumn of a new record of a model is determined by the maximum value of the ordercolumn of all records of that model + 1.

 

A big thank you goes out to Matthias De Winter, who is helping me update these packages.

Read more

The missing tail command for Laravel 5

by Freek Van der Herten – 1 minute read

Last week Laravel 5 was released. Unfortunately that handy command for tailing the logs that you know and love from Laravel 4 was not included. The laravel-tail package brings it back. You can install it via composer: composer require spatie/laravel-tail After that you'll have to register the…

Read more

An activity logger for Laravel 5

by Freek Van der Herten – 1 minute read

The activitylog-package provides a very easy way to log activities of the users of your app. Today I took the time to make it compatible with Laravel 5. Logging some activity couldn't be easier: [code] /* The log-function takes two parameters: - $text: the activity you wish to log. - $user: optional…

Read more

Higher order programming

This weekend at the PHPBenelux 2015 conference I went to a session about higher order programming by Mathias Verraes. Higher-order programming is a style of programming that uses functions as values.

During the session Mathias demonstrated his Lamdalicious library. This library brings the principles of LISP to PHP. The talk was very fast paced and everything was live coded. PHP was misused to the fullest: global variables, error suppression, ... and there was lots of recursion going on. Basically he was constructing another language in PHP. During the talk there were lots of ooohhss and aaahhhss in the room, so I suspect I was not the only one enjoying it.

If you are intrigued by this, be sure to read his blog post on the subject. The blog post is essentially the written down version of the talk.

You'll never use any of this code in production, but that's not the goal of the library. Like when doing code katas, the train of thought is much more important than the result.

Here's another wonderful blog post.

Read more

Generate image manipulations in a Laravel project

Earlier this month Glide joined The League of Extraordinary Packages. This package provides an easy way to generate image manipulations on the fly. Within a couple of hours I had integrated this wonderful package into both my company's legacy and current CMS.

The current CMS is based on Laravel. The Glide-integration is now available as a package on github: freekmurze/laravel-glide.

Installation

Nothing too fancy, you’ll have to:
  • use composer to pull in the package
  • install a service provider
  • install a facade
  • publish a config file
Read the specifics on Github.

Usage

Assuming you've got an image named `kayaks.jpg` in `app/storage/images` (this directory can be customized in the config file) you can use this code in a blade view:

<img src=&quot;{{ GlideImage::setImagePath('kayaks.jpg')->setConversionParameters(['w'=> 50, 'filt'=>'greyscale']) }}&quot; />

The function will output an URL to a greyscale version of kayaks.jpg that has a width of 50 pixels. As soon as the URL gets hit by your browser, the image will be generated on the fly. The generated image will be saved in app/storage/glide-cache (= the cache directory specified in the input file).

The generated URL will also be signed to prevent jerks from generating unwanted manipulations.

The setConversionParameters-function accepts an array with conversion options. You can take a look at the image API of Glide to see which options are available.

It's also possible to generate an image directly on the server:


GlideImage::setImagePath('kayaks.jpg')
    ->setConversionParameters(['w'=> 50, 'filt'=>'greyscale'])
    ->save($fileWhereImageManipulationMustBeSaved);

Read more

SSL certificate chain resolver

All operating systems contain a set of default trusted root certificates. But CAs usually don't use their root certificate to sign customer certificates. Instead of they use so called intermediate certificates, because they can be rotated more frequently.

A certificate can contain a special Authority Information Access extension (RFC-3280) with URL to issuer's certificate. Most browsers can use the AIA extension to download missing intermediate certificate to complete the certificate chain. This is the exact meaning of the Extra download message. But some clients (mobile browsers, OpenSSL) don't support this extension, so they report such certificate as untrusted.

A server should always send a complete chain, which means concatenated all certificates from the certificate to the trusted root certificate (exclusive, in this order), to prevent such issues. Note, the trusted root certificate should not be there, as it is already included in the system’s root certificate store.

This tools downloads all the intermediate certificates in the trust chain.

https://github.com/zakjan/cert-chain-resolver

Read more

Using Elasticsearch in Laravel

by Freek Van der Herten – 1 minute read

Elasticsearch is a lightning quick open source search server. It's java-based (but don't let that scare you) and can index and search documents. If you want to know more about it, watch this excellent talk by Ben Corlett. https://www.youtube.com/watch?v=waTWeJeFp4A For a recent Laravel project I had…

Read more

HTTP based image manipulations

Glide is a wonderfully easy on-demand image manipulation library written in PHP. It’s straightforward API is exposed via HTTP, similar to cloud image processing services like Imgix and Cloudinary. Glide leverages powerful libraries like Intervention Image (for image handling and manipulation) and Flysystem (for file system abstraction).
http://glide.thephpleague.com/

It comes with the ability to secure image URL's using a private signing key. I'm a bit worried about flooding the server but the owner of the package states that

... the cache filesystem + caching in league/flystem (with Redis/Memcache) should (at least this is the case in my testing) result in a speedy response...
There's also a risk that over time your cache will become gigantic. The maintainers of the package are already discussing possible solutions.

Read more

Automatically reject packages with known security vulnerabilities

This package ensures that your application doesn't have installed dependencies with known security vulnerabilities.

...

The checks are only executed when adding a new dependency via composer require or when running composer update: deploying an application with a valid composer.lock and via composer install won't trigger any security versions checking.

https://github.com/Roave/SecurityAdvisories

Awesome idea! It works by leveraging the "conflict"-property in the composer.json-file of the package.

Read more

A HTML5 rich text editor

Squire is an HTML5 rich text editor, which provides powerful cross-browser normalisation, whilst being supremely lightweight and flexible.

...

Unlike other HTML5 rich text editors, Squire was written as a component for writing documents (emails, essays, etc.), not doing wysiwyg websites. If you are looking for support for inserting form controls or flash components or the like, you'll need to look elsewhere.

http://neilj.github.io/Squire/

Read more