News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell:
Compiling PHP Extensions
August 29, 2014 @ 09:28:42

Lorna Mitchell has posted a quick guide to compiling PECL extensions to her site today. This is for those users on unix-based systems that might need to manually compile with some custom options (or may be working on your own extension and may just need to test it).

There are lots of reasons why you might like to compile your own PHP extensions. [...] I haven't seen a really approachable guide anywhere, we tend to speak of extensions in hushed tones, and actually it isn't particularly tricky so here is my quick how-to guide.

The process is relatively simple for those familiar with the command line and the steps involved in compiling software. There's some special PHP-only steps you'll have to take before compiling the code to make sure it's ready to be a PHP extension. Then it's up to the usual configure+make_make install to ensure the .so file is correctly generated.

0 comments voice your opinion now!
compile extension tutorial phpize module

Link: http://www.lornajane.net/posts/2014/compiling-php-extensions

SitePoint PHP Blog:
Build a Database with Eloquent, Faker and Flysystem
August 28, 2014 @ 11:55:09

In the latest post to the SitePoint PHP blog Aleksander Koko continues with his series about creating an application with PHP and EmberJS with a look at building databases. In the first part of the series he introduced the main toolset and set up a simple Laravel application inside of a Homestead instance. This latest post builds on that platform.

In this part, we will create the structure of the database. We will create the tables using migrations and seed the database using seeders. Also, you will learn how to grab some random images from LoremPixel and put them on the filesystem using Flysystem. You'll also be adding some randomly generated data using the Faker library. Much like with part 1, you can download this part's code from github.

He shows you how to get all the needed libraries installed and run the migrate command to create the needed tables. He also helps you set up a Dropbox application so you can use their API and configure the application with your API settings. Next he modifies the migrations and seeds the sample data. Next up he makes the models for each of the tables and integrates Faker to populate them with better seed data, making seeder classes to handle some of the more custom logic.

0 comments voice your opinion now!
database eloquent faker flysystem dropbox seed data tutorial emberjs

Link: http://www.sitepoint.com/build-database-eloquent-faker-flysystem/

SitePoint PHP Blog:
PINQ - Querify Your Datasets - Faceted Search
August 26, 2014 @ 10:58:22

The SitePoint PHP blog has continued their series showing the use of the PINQ library for PHP (a PHP implementation of the LINQ tool). In part one they introduced the tool and showed how to it could be used to query and sort data. In this second part they move on and show how to perform a multi-faceted search on data from a MySQL database.

We are not going to cover the full aspect of faceted search in this series. Interested parties can refer to relevant articles published on Sitepoint and other Internet publications. [...] Unfortunately, faceted search is not a built-in feature provided by MySQL yet. What can we do if we are using MySQL but also want to provide our users with such a feature? With PINQ, we'll see there is an equally powerful and straightforward approach to achieving this as when we are using other DB engines - at least in a way.

Building from the code from the first part of the series, they create a few more simple routes that let you define the different facets to use for the searching/sorting. He creates a custom facet class that uses the "traversable" handling of the PINQ to do the data manipulation. He creates a few different facet objects, each creating a customized filter. finally, he ties it all back into the endpoint and includes the updated markup to show the results. He finishes up the post mentioning a few limitations and improvements that could be made on the example as well.

0 comments voice your opinion now!
pinq query dataset mysql faceted search tutorial series part2

Link: http://www.sitepoint.com/pinq-querify-datasets-faceted-search/

Rob Allen:
Integrating ZF2 forms into Slim
August 26, 2014 @ 09:40:47

Rob Allen has a helpful post if you've ever wanted to take advantage of the simplicity of the Slim framework and the power of the Zend Framework 2 forms. In this latest post he walks you through the process of setting it all up and using the ZF2 elements outside of the main framework.

Let's say that you want to use Zend Framework 2′s Form component outside of ZF2 itself. In this case, a Slim application. It turns out that Composer makes this quite easy, though there's quite a lot of code involved, so this is a long article. Start with a really simple Slim Application...

His simple Slim application - just one route - handles both the GET and POST actions and uses several ZF2 components besides just the Form (dependencies mostly). He shows you the updates and additions you'll need to make to the service manager configuration and how to set up some custom validation and the form object in the controller. His example form only has two elements, an email field and a submit button and validation is done on the email address when it's submitted. Finally he includes the View object, extended from Slim's that combines some of the ZF2 and Slim handling to correctly render the form.

0 comments voice your opinion now!
form integration slim zendframework2 tutorial validation

Link: http://akrabat.com/zend-framework-2/integrating-zf2-forms-into-slim/

SitePoint PHP Blog:
Build a New App with Laravel and EmberJS in Vagrant
August 25, 2014 @ 11:31:58

The SitePoint PHP blog has kicked off another series of posts today with part one of a series looking at building an application based on the Laravel PHP framework and EmberJS.

Nowadays, everything is turning into a web application. Even simple websites have a mobile app relying on a REST Api. Web applications are accessible everywhere - on a laptop, desktop, tablet, mobile, and recently on wearable devices like smartwatches. Everything is becoming smaller and faster - front ends are becoming separated from back ends, and only communicate with the server through APIs. In this series, we are going to create a photo uploading app. For the front-end, we will use EmberJs and Foundation 5. [...] For the back-end, we will use Laravel. The source code will be available per-part, and in final shape in the final part of this series.

They go with the Laravel Homestead virtual machine (and Vagrant) to make for a quick setup and stable environment. They help you get it all set up to push up to Heroku and get all needed dependencies, both frontend and backend, installed. They also walk you through the setup of the database, configuring the connection and deploying the application to production.

0 comments voice your opinion now!
tutorial emberjs vagrant laravel homestead application series part1

Link: http://www.sitepoint.com/build-new-app-laravel-emberjs-vagrant/

Matthew Weier O'Phinney:
Testing Code That Emits Output
August 25, 2014 @ 09:45:08

In this latest post to his site Matthew Weier O'Phinney gives his suggestion on how to test (unit test) code that provides some kind of direct output. In his case, his script is outputting header information directly, not as a part of a response string.

Here's the scenario: you have code that will emit headers and content, for instance, a front controller. How do you test this? The answer is remarkably simple, but non-obvious: namespaces.

He talks some about the use of namespaces in PHP classes (and methods, and constants...) and how things can be importing using them. He gives an example of an object that outputs some header and body information (an "Output" abstract class). He shows how to use the class in a simple test, calling "reset" in the setup and teardown methods and asserting the contents of the headers and body for expected content.

0 comments voice your opinion now!
test unittest code phpunit output direct namespace tutorial

Link: http://mwop.net/blog/2014-08-11-testing-output-generating-code.html

SitePoint PHP Blog:
PINQ - querify your datasets - introduction
August 21, 2014 @ 09:20:19

The SitePoint PHP blog has posted the first part of a new series they're releasing about querying your data with Pinq. It's a PHP-based query tool that provides a fluent interface for searching and traversing your data. In this first post of the series Taylor Ren introduces you to the library and shows some basic usage.

You may have heard of LINQ (Language-Integrated Query), a "set of features introduced in Visual Studio 2008 that extends powerful query capabilities to the language syntax of C# and Visual Basic". It provides necessary interfaces and syntax to perform various queries on a given dataset so that operations like filtering, sorting, grouping, aggregating, etc can be performed. PINQ (PHP Integrated Query) is "based off the .NET's Linq, and unifies querying across arrays/iterators and external data sources, in a single readable and concise fluent API".

He talks about normal searching (equals matching) and "faceted searching", narrowing down the results piece by piece until you find what you need. He gives an example with some sample database data and shows the results of a simple query with a price filter and grouped by author. He includes the code to make it happen (inside a simple Silex application) too. He then takes a deeper look at the LINQ queries and how related statements are handled.

0 comments voice your opinion now!
linq pinq query dataset tutorial introduction series part1

Link: http://www.sitepoint.com/pinq-querify-datasets-introduction/

Oracle Coherence Blog:
Getting Started With The Coherence Memcached Adaptor (and PHP)
August 20, 2014 @ 10:55:45

As Chris Jones mentions in his latest post to his OTN blog, there's a tutorial that's been posted by David Felcey showing how to get started with Oracle Coherence via the memcached adapter in PHP. Coherence is Oracle's own version of a key/value storage that focuses on performance and scalability.

Coherence 12c (12.1.3) adds support for Memcached clients to directly store data a in Coherence cluster using the Binary Memcached protocol. This post outlines how to configure the Coherence Memcached Adaptor and includes a simple PHP example to show how Memecached clients can connect to a Coherence cluster.

He includes the XML configuration you'll need to create/modify on the Oracle side to make the memcached connections work and explains the different parts. With that in place, he moves on to the PHP example, showing a simple memcached request to store and retrieve a string. It's almost transparent to the PHP user save some of the configuration options required to make it work.

0 comments voice your opinion now!
oracle coherence introduction memcached adapter tutorial

Link: https://blogs.oracle.com/OracleCoherence/entry/getting_started_with_the_coherence

Lorna Mitchell:
Running Multiple Versions of PHP
August 20, 2014 @ 09:28:57

In the latest post to her site Lorna Mitchell has posted a helpful hint on how you can run multiple versions of PHP at once, mostly how to get the latest version without messing up your current install.

When I advise people about upgrading their PHP version, I say things like "just run your test suite with the new version" "just grab the new version and try your site with the built-in webserver". A couple of people recently have asked for more detail on how to actually achieve these things so here's a quick primer on getting new PHP without touching anything to do with your existing PHP installation.

You'll need a bit of knowledge around compiling software to get the job done, so if you're only used to aptget-ing or yum-ing you might be a little lost. She does include all the commands you'll need including the special "prefix" flag on configure telling it to put PHP in a different location than normal. She also includes a brief test to ensure that it's all up and working (using the built-in web server).

0 comments voice your opinion now!
multiple version language tutorial installation

Link: http://www.lornajane.net/posts/2014/running-multiple-versions-of-php

SitePoint PHP Blog:
APIfy Your Legacy App with Toro
August 19, 2014 @ 12:09:39

The SitePoint PHP blog has a new post that wants to help you API-ify your legacy application with ToroPHP, a router that's "designed for minimalists" to make routing and handling RESTful requests easier.

For the Google Summer of Code 2014, I was selected for a project to create a REST API for ATutor. ATutor has hundreds of thousands of lines of code, yet is written in core PHP. Introducing a PHP router class for the API was necessary, but we needed something unintrusive.

The result was the ToroPHP library. He introduces the library with some background about why it was created and some of the goals it was trying to achieve. Next he shows you how to create a simple "Hello World" endpoint that just defines the endpoint and echoes back the string. He shows how to separate out the logic from the route handling via the "urls.php" definition file. He also shows the handling of URL prefixes and mentions user authentication, making a "backbone" for the API and reuse of classes for similar objects.

0 comments voice your opinion now!
tutorial legacy application torophp library api rest

Link: http://www.sitepoint.com/apify-legacy-app-toro/


Community Events





Don't see your event here?
Let us know!


symfony api language interview wordpress threedevsandamaybe code library configure podcast application install laravel list series introduction developer community release bugfix

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework