Friday, January 15, 2016

Can PHP Be Even Faster? Light-Speed with the Blink Framework

Lumen, Silex, Slim, etc. you’ve heard of all of them. In this article, we’ll take a look at a newcomer called Blink.

Abstract image representing speed

Blink was built to improve high performance applications that consume a lot of server resources, and it uses the Swoole PHP extension to achieve this goal. As an example, we will build a Blink powered notejam for our demo. Let’s get started.

Installing The Swoole PHP Extension

We mentioned earlier that Blink relies on the Swoole extension for better performance.

You can install the Swoole extension from source on Github. Follow this article if you don’t know how to do it.

The alternative way to install it is by using the PEAR package manager, which is the approach I’ll take. I will be using an Ubuntu 14.04 image with the LAMP setup for this article, configured via Vaprobash - to get this exact setup, refer to the Vagrantfile in this project’s final repo. We could’ve used Homestead improved to easily set up the environment, but the Swoole extension is only compatible with PHP 5 for now, and Homestead Improved uses PHP 7 by default.

# update repositories
sudo apt-get update 

# Install pear manager
sudo apt-get install php-pear

# PHP source to compile the extension
sudo apt-get install php5-dev

# Used to install package dependencies
sudo apt-get install libcurl3-openssl-dev

# Installing Swoole
sudo pecl install swoole

The current Swoole version is 1.7.22-alpha and it’s not compatible with PHP 7, but there is an ongoing effort to make this happen in the next minor version.

After the commands above execute, we’re asked to add the extension=swoole.so line to php.ini. You can make sure that the extension is loaded by listing the available PHP modules command.

php -m | grep 'swoole'

Blink is available on Packagist, so we can use Composer to create a new project.

composer create-project --prefer-dist blink/seed

After all the dependencies have been loaded, you can run the server from the command line.

php blink server serve

This command will run an interactive shell for logs. However, you may use the php blink server start/stop/restart commands to manage the server.

We can make sure that everything is working as expected by visiting port 7788 of our local server:

Hello world

Configuration

While Blink doesn’t provide an option from the command line to specify the port, we can use the config/server.php file to change it.

// src/config/server.php

<?php
return [
    'class' => '\blink\server\SwServer',
    'bootstrap' => require __DIR__ . '/../bootstrap.php',
    'host' => '0.0.0.0',
    'port' => 8080,
];

Now, restart your server and check the browser using the new port. The config folder also holds configuration for our app and services.

Continue reading %Can PHP Be Even Faster? Light-Speed with the Blink Framework%


by Younes Rafie via SitePoint

The 7 Best Resources for Web and Mobile App Animations

A user's experience is driven by the interactions between the person and the interface. On web and mobile platforms alike, subtle motion is an increasingly popular way to add value and delight.

Today developers can integrate an entire palette of HTML5, CSS, and Javascript based animations for both mobile web and native applications. This means that however users access your content or services you can provide them with the same fantastic experiences.

In this article I will present a list of my 7 favorite well known and underground animation libraries that will add eye-catching motion to your UI.

Continue reading %The 7 Best Resources for Web and Mobile App Animations%


by Dennis Williams via SitePoint

This week's JavaScript news, issue 266

This week's JavaScript news
Read this e-mail on the Web
JavaScript Weekly
Issue 266 — January 15, 2016
Almost every JavaScript developer owes something to jQuery which continues to be heavily used on the Web. Its creator reflects on jQuery’s 10th birthday. Also further reflections by Dave Methvin.
John Resig

Take advantage of multi-threading in the browser using ParallelJS, a library that provides a more convenient API for working with Web Workers.
Florian Rappl

Not on the ES6 train? Eric Elliott presents a handy learning roadmap for you.
Eric Elliott

Free open source REST API platform for SQL, NoSQL, file storage, email, or remote web services. Hosted version for rapid prototyping with production ready results. Spin up a free instance in seconds.
Dreamfactory   Sponsored
Dreamfactory

There will no longer be any support for IE8, but otherwise there are only a few major changes to be aware of, including jQuery.Deferred being Promises/A+ compatible, a change to how .data() works, and more.
Timmy Willison

Following on from other ‘awesome’ themed link lists comes one aimed at the npm ecosystem, but it includes a variety of npm-related tips too.
Sindre Sorhus

Following on from its announcement at JSConf, the core of MS’ JavaScript engine from IE/Edge is now open source and available on GitHub.
Microsoft Edge Dev Blog

Fluent is a major Web Platform and JS conference, this year taking place in San Francisco on March 7-10. Four of us from Cooper Press will be there, and we'd love to see you!
O'Reilly Media

A short, tidy, and practical example of using generators and promises to elegantly deal with asynchronous data inputs and outputs.
Nicolas Bevacqua

Jobs

In brief

Curated by Peter Cooper and published by Cooper Press.

Stop getting JavaScript Weekly : Change email address : Read this issue on the Web

© Cooper Press Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK


by via JavaScript Weekly

Sturlly

Sturlly | Responsive OnePage Multipurpose Template

'Sturlly' is a One Page HTML template. There are three intro section background options - slideshow, video or parallax background. There are 8 demos including Fashion (seen in this screenshot), Restaurant, Interior Design, Travel Agency, Personal Resume, Design Agency, Architecture Firm and Spa Salon. What's awesome to know is there is also a WordPress version.

by Rob Hope via One Page Love

Konst & Teknik

opl-small

One Pager for Stockholm-based design studio Konst & Teknik featuring a minimal big image portfolio slider - click the right area for next, click left for previous.

by Rob Hope via One Page Love

Offer: Pay What You Want for the White Hat Hacker Bundle

Beat hackers at their own game…and use those skills to up your own game and get a job in penetration testing. Pay what you want for seven white hat hacking courses at SitePoint Shop.

Master penetration testing and learn how to crack passwords, get remote control of devices, steal data, attack routers, and more—everything that companies want protection from. You’ll think like a hacker to gain the skills to thwart their attempts…and start your career in white hat hacking. You’ll have lifetime access to all of the material, so you can start as a complete beginner and work your way up.

Pay what you want for this white hat hacking bundle worth $765 at SitePoint Shop.

Continue reading %Offer: Pay What You Want for the White Hat Hacker Bundle%


by SitePoint Offers via SitePoint

Adrian Cabrero Photography

Adrian Cabrero | Photography & Creative Exploration

Long scrolling One Pager forming the photographic portfolio of Adrian Cabrero. Good to see the considerate "lazy load" functionality on a long image-heavy Single Page website. Cheers for the detailed build notes.

by Rob Hope via One Page Love