freekmurze

Developer at Spatie

Hire Me

Experience

37,230

7 Best Reply Awards

  • Member Since 3 Years Ago
  • 699 Lessons Completed
  • 10 Favorites

14th June, 2017

freekmurze left a reply on Pagination Using JSON API Strategy. • 5 months ago

I've packaged up this code (and gave you some credit for you)

https://github.com/spatie/laravel-json-api-paginate

freekmurze left a reply on Pagination Using JSON API Strategy. • 5 months ago

Turns out Illuminate\Database\Eloquent\Builder is Macroable

So you can do this in a service provider:

        Builder::macro('jsonPaginate', function($maxResults = 30) {
            $size = request()->input('page.size', $maxResults);

            if ($size > $maxResults) {
                $size = $maxResults;
            }

            $paginator = $this->paginate($size, ['*'], 'page.number');

            $paginator->setPageName('page[number]');

            $paginator->appends(array_except(request()->input(), 'page.number'));

            return $paginator;
        });

and use on all models.

Model::jsonPaginate()

13th June, 2017

freekmurze left a reply on Pagination Using JSON API Strategy. • 5 months ago

Hi, on which object should this trait be applied?

24th November, 2016

freekmurze left a reply on Error When Upgrading To Laravel 5.3 • 11 months ago

Did you remove the compiled file?

22nd November, 2016

freekmurze left a reply on Website Monitoring • 11 months ago

freekmurze left a reply on Monitor Site Availability • 11 months ago

Hi, I made a Laravel package the can monitor both uptime and ssl certificates. It can send out notifications to Slack (or any other notification provider you prefer) when something goes wrong.

Read all about it here: https://murze.be/2016/11/an-uptime-and-ssl-certificate-monitor-written-in-php/

26th June, 2016

freekmurze left a reply on Laravel 5.3 Wish List • 1 year ago

I'd like to have Adam's pipe macro as a regular function on the collection class. https://github.com/laravel/framework/pull/13899

freekmurze left a reply on Laravel 5.3 Wish List • 1 year ago

@xsmall I've made some packages that you might find useful:

All three packages have extensive docs, so you should have no problem using them. If you have a question about them, feel free to submit an issue at GitHub.

21st June, 2016

freekmurze left a reply on Laravel And Fractal • 1 year ago

I've written an easy to use package to integrate Fractal into Laravel/Lumen: https://github.com/spatie/laravel-fractal

9th June, 2016

freekmurze left a reply on Metrics Dashboard Using Vue And Laravel? • 1 year ago

Here's my take on implementing a dashboard with Laravel and Vue: https://murze.be/2016/06/building-dashboard-using-laravel-vue/

freekmurze left a reply on Uploading Files On S3 As Private File And Then Accessing The File • 1 year ago

The medialibrary package can upload files to S3 and generate URL's to them: https://docs.spatie.be/laravel-medialibrary/v4/introduction

freekmurze left a reply on Dashboards And Statistics • 1 year ago

I've recently created a dashboard that uses Larave, Vue, Pusher and graph.js. Read all about it here: https://murze.be/2016/06/building-dashboard-using-laravel-vue/

2nd March, 2016

freekmurze left a reply on Mailchimp SSL Certificate Problem • 1 year ago

@bashy thanks, will try that on the next droplet that is giving me troubles

1st March, 2016

freekmurze left a reply on ZipArchive Not Found In PHP 7 Forge Servers • 1 year ago

I think it's a very new problem. ZipArchive is only missing from server I've set up in the last couple of days.

To install it just run this command:

sudo apt-get install php7.0-zip

@bobbybouwmann and it's indeed necessary for the backup package :-) New major version will be released somewhere this week.

freekmurze started a new conversation ZipArchive Not Found In PHP 7 Forge Servers • 1 year ago

Newly provisioned Forge server do not seem to have ZipArchive installed.

new ZipArchive(); //results in class not found error.

Anybody have clear instruction on how to install this?

freekmurze left a reply on Mailchimp SSL Certificate Problem • 1 year ago

I encountered this problem as well. Just rebooting the droplet solved the problem. Pretty sure there must be a more elegant way of solving this.

4th February, 2016

freekmurze started a new conversation Always Backup Your Servers • 1 year ago

Yesterday one of my servers at DigitalOcean simply ceased to exists. If I had not made backups all the data of a client would be lost. Read the full story here: https://murze.be/2016/02/today-digitalocean-lost-our-entire-server.

If you are using one of those fancy cloud hosting providers like DigitalOcean, Linode or AWS as well make sure that you have backups of all your files and all your client files.

Forewarned is fore armed!

3rd February, 2016

freekmurze left a reply on Laravel 5 Route For Robots.txt • 1 year ago

My company made a package that solves this problem.

https://github.com/spatie/laravel-robots-middleware

Instead of you having to create a robots.txt this package will add a x-robots-tag to every request. You can extend the middleware to add custom logic that determines if the tag should be added and what the contents of the tag should be.

13th January, 2016

freekmurze left a reply on Laravel Full Page Caching • 1 year ago

Try to removing:

$response = $next($request);

and replacing

return $response;

by

return $next($request);

8th December, 2015

freekmurze started a new conversation How To Install The Imagick Extension For PHP7 • 1 year ago

Hi,

I provisioned a server with PHP 7 using Forge. I want to use imagick. What is the correct way to install the imagick php extension?

24th November, 2015

freekmurze left a reply on Obfuscate Download URLs? • 1 year ago

You might be interested to know that the medialibrary package gained support for custom directories

6th October, 2015

freekmurze started a new conversation Code Review: A Fractal Service Provider For Laravel • 2 years ago

Hi,

I put some work in an easy to use Fractal integration today. I'm welcoming all feedback before I tag version 1.0.0. tomorrow.

https://github.com/spatie/laravel-fractal

freekmurze left a reply on Fractal And Auth Server Tutorials • 2 years ago

If you're looking for an easy integration of Fractal with Laravel, I'm currently working on it

28th September, 2015

freekmurze left a reply on ACL Middleware • 2 years ago

I've created a middleware to check authorization on the route-level and released it as package. Take a look: https://github.com/spatie/laravel-authorize

24th September, 2015

freekmurze left a reply on Localization Series • 2 years ago

+1

11th September, 2015

freekmurze left a reply on HTTPS Health Check URL • 2 years ago

You've already figured it out while I was typing. Nice!! :-)

freekmurze left a reply on HTTPS Health Check URL • 2 years ago

Some browsers, like Chrome and Safari, fetch the certificate chain themselves if it is incomplete. Others, notably Firefox and a few mobile browsers do not. So if you're using Chrome you probably won't see the issue that users of other browsers (and command line tools) are having.

Normally Comodo should have sent you the intermediate certificates as well. You'll need to manually concatenate those after your domain specific certificate. It's a bit tedious error prone.

Alternatively you could just paste your domain specific certificate into https://certificatechain.io It will return your certificate concatenated with all intermediates. This is much easier than doing it manually.

If you've already installed a certificate for your domain Forge with tell you the file where the certificate is installed. It should look something like /etc/nginx/ssl/<your domain name>/<random number>/server.crt Just paste paste the whole chain (= specific certificate + intermediates) into that file and you're golden :-)

freekmurze left a reply on HTTPS Health Check URL • 2 years ago

Maybe there's something wrong with the certificate. Have you checked with a tool like https://www.ssllabs.com/ssltest/ if everything is ok?

Did you install the intermediate certificates as well? If not, you may find https://certificatechain.io/ helpful.

10th September, 2015

freekmurze left a reply on Anyone Know Of Any Issues With OS X El Capitan GM? • 2 years ago

I installed the GM this morning on both my MacBook pro (2015) and iMac (2011). Zero issues. Homestead / Vagrant is running fine. Npm just works. All apps are regulary use (phpstorm / sequel pro/ slack / iTerm 2) are just working

Your mileage may vary.

9th September, 2015

freekmurze left a reply on SFTP Upload • 2 years ago

You could create an sftp disk. Look in the Filesystem / Cloud storage documentation for more info.

7th September, 2015

freekmurze left a reply on Laracast - Bulk File Uploads - Syntax Question • 2 years ago

After years of PHP programming, until shortly, I didn't know that syntax. I wrote a little post about it on my blog. ES6 can now do this as well.

2nd September, 2015

freekmurze left a reply on Image Upload Using Storage Function To Public Folder • 2 years ago

I've made a package called medialibrary that fits your use case.

Once installed you can do this:

$yourModel->addMedia($yourUploadedFile)-> toMediaLibraryOnDisk('images','s3')
```php

Retrieving the url to a file that's stored in the library is easy as well:
```php
$yourModel->getFirstMediaUrl('images') //returns an url that points to your file on S3

The package uses streams to upload to S3, so upload big files aren't a problem. Of course there's support for using the local filesystem as well. The package also can create thumbnails of your images. The generation of such thumbnails can be queued.

Take a look at the documentation to learn what's possible.

6th August, 2015

freekmurze left a reply on Isolate Sites • 2 years ago

You could also opt to just provision two Forge servers. There's no better isolation than that. But of course you'll also double the hosting bill.

freekmurze left a reply on Require File • 2 years ago

If you want to require certain files explicitly on every request then you can use Composer's 'files' autoloading mechanism: https://getcomposer.org/doc/04-schema.md#files

freekmurze left a reply on Package Development • 2 years ago

This is a blog article on how Prosper Otemuyiwa starts developing packages (cached version, his site seems to be down atm)

And you can read on my blog how I do start working on package myself.

5th August, 2015

freekmurze left a reply on Upload Image • 2 years ago

I have made a package that does all the hard work for you. Once installed you can do this:

$post->addMedia($request->file('image'))->toCollection('images');

You can display the image in your blade view with:

<img src="{{ $news->getFirstMediaUrl('images') }}">

If you want a thumbnail of that image:

<img src="{{ $news->getFirstMediaUrl('images', 'thumb') }}">

The full documentation: https://github.com/spatie/laravel-medialibrary

4th August, 2015

freekmurze left a reply on [SUGGESTION] Handling Images In Tables? • 2 years ago

Take a look at my medialibrary package. It can associate images with Eloquent models and create images of different sizes: https://github.com/spatie/laravel-medialibrary

freekmurze left a reply on Image Handling And Display • 2 years ago

I made a package that just might fit your requirements: https://github.com/spatie/laravel-medialibrary Check it out!

29th July, 2015

freekmurze left a reply on Check If A Variable Exists • 2 years ago

you're probably looking for the isset function

26th July, 2015

freekmurze left a reply on Package For Managing Images • 2 years ago

Take a look at laravel-medialibrary. It can relate Eloquent models with files and generate derived versions of images/pdfs.

freekmurze left a reply on Laravel Project Backup • 2 years ago

If you want to backup both the database and user generated files, take a look at this package.

21st July, 2015

freekmurze left a reply on Backup Of Files Not Working With Package • 2 years ago

You have added the base_path() as an excluded directory. This result of this is that every file with get excluded.

freekmurze left a reply on [tip] A Neat Web-app For A Log Tail • 2 years ago

Very nice!

17th July, 2015

freekmurze left a reply on Advanced Optimizations • 2 years ago

I'm currently working on a package that can greatly improve the performance of any Laravel app. It can cache the entire response. Check the readme for details: https://github.com/spatie/laravel-responsecache ETA for version 1.0.0: somewhere next week.

19th May, 2015

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.