Update: We have rebranded into Catzie’s Cakery. When I’m not busy tapping codes on my keyboard, I either watch anime or bake. And there’s this “tiny” baking business in Manila I’m running, and really have a good time baking for people – friends, family, and even people I haven’t met prior to handing over their […]
Web Development
Installing Laravel 5 on Apache in Mac OS X El Capitan
Last time, I wrote a guide on How to install Laravel 5 in Windows with XAMPP. I’ve been coding more often on Mac computers recently, and now I need to setup Laravel on a MacBook Pro, so I decided I’ll write a guide on how to install Laravel 5 on Mac OS X El Capitan […]
PHP: Parse Dates in CSV with inconsistent date formats
A friend was having trouble with a CSV file that she needs to process via PHP before saving to database. The CSV files uploaded to the server have inconsistent date formats such as:
1 2 3 4 5 |
November 1, 2016 Dec.6,2016 nov-10-2016 12122016 12/10/2016 |
So I prepared a PHP script that lists possible date formats in an array $possible_date_formats and then iterates through the dates […]
Install & config Apache, MySQL and PHP on your Mac (MAMP)
There’s a Mac computer that I want to use as local development server for web apps. I don’t want to use bundled installers like XAMPP or MAMP because I feel that I will learn more about Apache if I install each component of the LAMP stack separately. By the way, one of my goals is […]
Web Security: How SQL Injection is done
SQL injection is one of the most common website exploits. For us developers to prevent SQL injection attacks, we must first understand how it’s done. Together, let’s review the basics of SQL injection. Remember, let’s use our knowledge on good things only, okay? The scope of this post is only a MySQL injection sample from […]
Prevent direct access to directories of subdomains
From my hosting platform (e.g. cPanel), I created two subdomains for web apps. The web apps reside in the following directories: /foo/bar/app_one/ /foo/bar/app_two/ And the subdomains I created are accessed through these URLs: http://app_one.bar.domain.com (pointing to /foo/bar/app_one/ directory) http://app_two.bar.domain.com (pointing to /foo/bar/app_two/ directory) For security purpose, I don’t want anyone to access the web app […]
Laravel 5: activate API token guard and print “Unauthorized” instead of login redirect
In Laravel 5, I wrap my API routes in a route group like this:
1 2 3 |
Route::group(['middleware' => ['auth:api','throttle']], function() { // API routes here }); |
Notice that I use auth:api and throttle on my middleware array. auth:api turns on the auth middleware with API token as guard, while throttle activates rate limiter for APIs. To get started with API token authentication, you may read https://gistlog.co/JacobBennett/090369fbab0b31130b51. […]
Laravel 5 RESTful API with Basic Auth: PHPUnit Testing
I’ve been using PHPUnit to test my RESTful API. PHPUnit is ready to use in Laravel. In my Laravel-based RESTful API, I have an endpoint /api/users which returns JSON data when you send a GET request. The API will only return such data if the client sends the corrent username and password (Basic Authentication). The […]
Laravel update from v.5.0.35 to v.5.2.32 hiccups and solutions
I tried to update Laravel 5 today and here were the steps I had to take. First checked my Laravel version before the update:
1 2 |
$ php artisan --version Laravel Framework version 5.0.35 |
Edited composer.json in my laravel’s root folder like such:
1 2 3 |
"require": { "laravel/framework": "5.2.*" } |
Run this on command line:
1 |
composer update |
You might need to delete root folder’s composer.lock file before the update can actually […]
Laravel 5: Create controller under new folder and routing
So here I am on a Sunday, trying to make progress with a personal Laravel 5 site I need to work on. As I bear with the noise outside in the street (some crazy neighbors set up a swimming pool IN THE STREET! :oops:), I’m trying to figure out how too create a new Laravel […]