All entries of my technical and business blog

For Performance, Skip Generating Hashes in Laravel Factories

Nov 15, 2017 laravel php

This isn’t a one-size-fits-all suggestion, but it’s a start to help you think about how you actually interact with factories in Laravel. They are used for test data, and are ran very often, multiple times in a row. You don’t need as much random information as you need. (In fact, a lot of times I see people overusing Faker even.)

Pitch to Programmers Like Investors

Nov 15, 2017 business

What’s the difference between pitching for new programmers to join the team vs investors to fund it? Nothing. If you’ve not been pitching both of them with equal detail and vigor, you’re missing out.

Laravel Pretty Print JSON Middleware

Nov 14, 2017 laravel php

For testing, I tend to use Postman - which gives you the option to view your API JSON responses in a preview mode (interactive), pretty and raw. But, the other day I heard someone saying sometimes they just want to invoke pretty print in their JSON responses without having to use an external tool and set up a whole environment.

Anatomy of a PHP Hack

Nov 7, 2017 php security

It’s hard to come up with a title for this - but - basically I found some rogue code the other day that I thought was pretty interesting. I was fixing a “hacked” website when I came across the source of the symptoms of the hack. One file had the following code in it:

Studly Words in Laravel

Oct 25, 2017 laravel php

In Laravel, the Support\Str class has a lot of useful methods for switching formats of strings between each other. I needed to take a hyphenated slug and change it to title case words. In Laravel land, I think this is referred to as “Studly” - because I found something very similar called Str::studly(). This converts underline or hyphenated words into a single string with capital letters. I wanted to not concatenate all of these.