Quantcast
Channel: php – Bram.us
Browsing all 166 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Composer Cheat Sheet

Composer is the dependency manager for PHP. This site is a one-page-only doc for this tool. It has a very nice and well-supplied documentation on the official website, this page just brings you the...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article


Heroku

Good news from Heroku: PHP is (finally) properly supported. Just add a composer.json file to your repo and Heroku will know your app runs PHP. Yes, you see that right: Composer is supported. Whenever...

View Article

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....

View Article

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...

View Article


PHP Geotools

<?php $geotools = new \League\Geotools\Geotools(); $coordinate = new \League\Geotools\Coordinate\Coordinate('40.446195, -79.948862'); $converted = $geotools->convert($coordinate); // convert to...

View Article

Image may be NSFW.
Clik here to view.

PHP Null Coalesce Operator

The coalesce operator – ?? – returns the result of its first operand if it exists and is not NULL, or else its second operand. That indeed means that it won’t raise an E_NOTICE, and affords you to...

View Article

Image may be NSFW.
Clik here to view.

PHP 5.6: “Automatically populating $HTTP_RAW_POST_DATA is deprecated and will...

Since PHP 5.6, the use of $HTTP_RAW_POST_DATA is deprecated. Now, I’m not using this so I’m in the clear, or at least I thought I was … tl;dr The default value for always_populate_raw_post_data in PHP...

View Article


grunt-php

$ npm install --save-dev grunt-php require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks grunt.initConfig({ php: { dist: { options: { port: 5000 } } } });...

View Article


Securing Sessions in PHP

I set out to combine all the best practice I could find into a single Session handler, to help protect against the common attack vectors. Since PHP 5.4, you are able to set the Session handler based on...

View Article

Image may be NSFW.
Clik here to view.

phpspec

phpspec is a development tool, designed to help you achieve clean and working PHP code by using a technique derived from test-first development called (spec) behaviour driven development, or SpecBDD....

View Article

It’s All About Time: Timing attacks in PHP

$query = "SELECT * FROM users WHERE id = ?"; $stmt = $pdo->prepare($query); $stmt->execute([$_POST['id']]); $user = $stmt->fetchObject(); if ($user &&...

View Article

Image may be NSFW.
Clik here to view.

Mixed Content Scan: Scan your HTTPS-enabled website for Mixed Content

With my recent move to HTTPS I wasn’t sure if there were any pages left on my site that had Mixed Content or not. If an HTTPS page includes content retrieved through regular, cleartext HTTP, then the...

View Article


Image may be NSFW.
Clik here to view.

On PHP Version Requirements

Anthony Ferrara (ircmaxell): I learned something rather disturbing yesterday. CodeIgniter 3.0 will support PHP 5.2. To put that in context, there hasn’t been a supported or secure version of PHP 5.2...

View Article

PHP Roave Security Advisories

$ composer require roave/security-advisories:dev-master $ # following commands will fail: $ composer require symfony/symfony:2.5.2 $ composer require zendframework/zendframework:2.3.1 This package...

View Article


Image may be NSFW.
Clik here to view.

Blackfire Profiler

Blackfire Profiler automatically instruments your code to gather data about consumed server resources like memory, CPU time, and I/O. But Blackfire Profiler is more than figures; its interactive...

View Article

AWS Resource APIs for PHP

<?php require 'vendor/autoload.php'; use Aws\Resource\Aws; $aws = new Aws([ 'region' => 'us-west-2', 'version' => 'latest', 'profile' => 'your-credential-profile', ]); $bucket =...

View Article


Image may be NSFW.
Clik here to view.

PHP 7: Immediately Invoked Function Expressions

PHP7 will continue to borrow some of the beloved JavaScript features and will support Immediately Invoked Function Expressions (IIFEs): <?php echo (function() { return 42; })(); Output for...

View Article

Image may be NSFW.
Clik here to view.

PHPCI – Continuous Integration for PHP Projects

PHPCI is a free and open source continuous integration tool specifically designed for PHP. Built with simplicity in mind and featuring integrations with all of your favourite testing tools, we’ve...

View Article

Image may be NSFW.
Clik here to view.

Monolog Colored Line Formatter

Over a year ago I quickly whipped up a Colored Line Formatter for use with Monolog. As I’m building colorised output into Mixed Content Scan I – finally – took the time to actually put the darn thing...

View Article
Browsing all 166 articles
Browse latest View live