PHP Geotools

<?php $geotools = new \League\Geotools\Geotools(); $coordinate = new \League\Geotools\Coordinate\Coordinate(‘40.446195, -79.948862’); $converted = $geotools->convert($coordinate); // convert to decimal degrees without and with format string printf(“%s\n”, $converted->toDecimalMinutes()); // 40 26.7717N, -79 56.93172W printf(“%s\n”, $converted->toDM(‘%P%D°%N %p%d°%n’)); // 40°26.7717 -79°56.93172 // convert to degrees minutes seconds without and with format string printf(“%s\n”, $converted->toDegreesMinutesSeconds(‘%P%D:%M:%S, %p%d:%m:%s’)); // 40:26:46, -79:56:56 printf(“%s\n”, $converted->toDMS()); …

Build your own PHP Framework with Symfony Components

switch($_SERVER[‘PATH_INFO’]) {     case ‘/’:         echo ‘This is the home page’;         break;     case ‘/about’:         echo ‘This is the about page’;         break;       default:         echo ‘Not found!’; } Good introduction on the Sitepoint website to getting started with a few of the Symfony Components. Starts with the example code above and – one by one – introduces the …

PHP Coding Standards Fixer

php php-cs-fixer.phar fix /path/to/dir The PHP Coding Standards Fixer tool fixes most issues in your code when you want to follow the PHP coding standards as defined in the PSR-1 and PSR-2 documents. If you are already using PHP_CodeSniffer to identify coding standards problems in your code, you know that fixing them by hand is …

PHP and Continuous Integration with Travis CI

Travis CI automatically sets up a CI environment and makes it simple for anyone to test and deploy their app. Their build system supports many different languages, you just have to define which language this project is and Travis CI will take care of the rest Good article by Sitepoint on getting started with Travis …

PHPloy – Git FTP Deployment

; This is a sample deploy.ini file. ; You can specify as many servers as you need ; and use whichever configuration way you like. [staging] user = example pass = password host = staging-example.com path = /path/to/installation port = 21 passive = true [production] user = example pass = password host = production-example.com path …

Getting ready for PHP 5.6

PHP 5.6.0, currently in alpha, will hit us any time later this year. Time to take a look and see what’s new. Here’s a selection of features that will affect the way you and I code. New __debugInfo() magic function (rfc) This new magic function allows you to instruct PHP what it should output when …

React-PHP-V8Js

// the library $react_source = file_get_contents(‘/path/to/build/react.js’); // all custom code concatenated $app_source = file_get_contents(‘/path/to/custom/components.js’); $rjs = new ReactJS($react_source, $app_source); $rjs->setComponent(‘MyComponent’, array( ‘any’: 1, ‘props’: 2)); /// … // print rendered markup echo ‘<div id="here">’ . $rjs->getMarkup() . ‘</div>’; React-PHP-V8Js is an experimental library that uses the power of Facebook’s React library to render UI components …

PHP Augmented Types

/** * @param int $a * @return float[] */ function foo ($a) { echo “You passed in the integer $a”; return [$a * 1.0, $a * 2.718]; } Augmented Types simply provides a way of enforcing argument and return types on function calls in PHP. It parses a given function’s type information from phpDoc-style type …