Stefan Kecskes

Never stop learning, because life never stops teaching

Setting up XDebug for dev environment

Debugging PHP in editor I would like to describe how to set up xDebug to work in your phpStorm IDE. There are different options available depending on your preference - you can have xDebug always try to initiate a connection for your devbox, or you can use browser plugins and extensions to choose when xDebug should try to run. Requirements sudo access to virtual host config files Automatic connection This method means that you don’t need any browser extensions, cookies or bookmarklets, but may cause small performance issues because xDebug will try and initiate a connection to your computer on port 9000 every time you load a page on your dev.

Laravel validator for CSS selectors

Laravel 5.1 Validators Last week I was building a backend tool in Laravel, where you could create layout in bootstrap 3 and add CSS selectors like id or class to any container. You wanted to be able to enter more than one class name into input field. Let’s say that you want to add 2 classes: col-xs-6 infoBox_4. Laravel hasn’t validator for this type of string, so I decided to make one.

PHP Modules

Php modules or extensions are pieces of code for PHP, which extends the basic functions and add or improve the existing functions. Some of them are already bundled with PHP and can be easily enabled or disabled. There are also external PHP modules which can be installed to system and then enabled in PHP. Even though you now have installed the PHP you still may come across some issues. Some of the frameworks or libraries will possibly need use of some module which wasn’t added to php.

Installing Composer.phar

What is composer? Now we don’t have to reinvent wheel, we can select the tyre, the rim, the gauge. Same way in PHP we don’t have to write everything from scratch but we use Composer will give us these components so that they will work together without compatibility issues. Composer is the dependency manager for PHP. That means that chunks of php code, which are tested and each package solves one some problem are packed into a packages and added to packagist repository.

LAMP stack

What is LAMP stack? LAMP stands for Linux - Apache - MySql - PHP. This is basically everything you need to have a fully working testing server on your machine. Some parts of LAMP may already be installed on your system. If so uninstall them. I will assume, that nothing is installed, and we will install all parts of LAMP. The following steps should be same and compatible with all Debian based systems (Ubuntu is one of them).