Php

Setting up caddy server for wordpress

Setting up caddy server for wordpress

Caddy is a another alternative to Apache or nginx . For me the biggest advantage is that it’s only one binary file to work with. It’s easy to run, setup and just “works”. It’s super modern – handles HTTP2 and automatic HTTPS encryption using let’s encrypt certificates. Obviously it has plenty of other features but we focus only on speed of deployment.

PhpStorm PHPCodeSniffer and… CodeIgniter style guide

This article is related to my previous one about setting up PHPCodeSniffer with CodeIgniter coding standards.

Installation on Linux boxes is pretty yeasy:

sudo pear channel-update pear.php.net
yum install php-pear-PHP-CodeSniffer php-phpunit-phpcpd

On Mac OS X you have couple options. Pear or Homebrew:

brew install php-code-sniffer

And following that, on regular boxes CodeSniffer will be here:

/usr/share/pear/PHP/CodeSniffer/Standards

on Mac OS CodeSniffer will be located here:

/usr/lib/php/pear/PHP/CodeSniffer/Standards or… /usr/local/Cellar/php-code-sniffer/1.5.6/CodeSniffer/Standards

CodeIgniter standard can be downloaded from this location  https://github.com/thomas-ernest/CodeIgniter-for-PHP_CodeSniffer

PHPUnit and CodeIgniter 3.0

PHPUnit and CodeIgniter 3.0

Quick tutorial how to setup proper unit testing with PHPUnit and CodeIgniter 3.0.
We need couple elements

  1. CodeIgniter – we are working with version 3.0rc3
  2. PHPUnit  – latest one

If you don’t have phpunit installed globally, you can go with composer, just add section to your composer.json

{
  "require-dev": {
    "phpunit/phpunit": "4.1.*"
  }
}

and then
composer.phar install
and after while we have
./vendor/bin/phpunit
working phpunit.

let’s create phpunit.xml.dist

next step will require create separate bootstrap file for PHPUnit. Just copy cp index.php tests/Bootstrap.php
We have to make 2 small amends.