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

SitePoint PHP Blog:
Best Practices REST API from Scratch - Introduction
July 22, 2014 @ 09:39:12

The SitePoint PHP blog has posted the second part of their series looking at building up a REST API "from scratch". In this latest post Vita Tardia introduces some of the basic topics and the best practices that are around their use.

The current internet ecosystem has literally been invaded by APIs, and for good reasons. By using third party APIs in your products or services, you have access to a ton of useful features - such as authentication or storage services - that can benefit both you and your users. By exposing your own API, your application becomes "part of the mix" and will be used in ways you've never thought before… if you do it the right way, obviously. In this two part series I'll show you how to create a RESTful API layer for your PHP applications, using a collection of real world best practices.

He talks about how a REST API is a "user interface for developers" and the actions the different verbs could take on the same endpoints (PUT, POST, GET, etc). He uses the Slim framework in his examples and helps you get an instance all set up and working. He includes a bit about getting SSL/HTTPS up and running for all requests to the site too. From there he gets into the bootstrapping of the application and the first version of controller handling. He also includes code examples touching on JSON handling, authentication and good error handling.

0 comments voice your opinion now!
tutorial rest api introduction slimframework bestpractices

Link: http://www.sitepoint.com/best-practices-rest-api-scratch-introduction/

SitePoint PHP Blog:
Getting Started with FluentPDO
July 17, 2014 @ 11:08:01

The SitePoint PHP blog recently posted a new tutorial helping you get up and running with FluentPDO, a small PHP library that makes building queries easier and faster. In the tutorial Francesco Malatesta introduces you to the tool and creates a test project to show it in use.

You know the story: writing SQL queries is so boring. Especially when you don't have time to do it. If you feel like me, today we are going to see something really cool: Fluent PDO. [...] The result? No more SQL queries. Maybe this is not the first one you have seen: there are many similar projects out there and every single one has its key features. Fluent's key feature is a great JOIN Query Builder.

His test project links a "wishlist" listing with a users table based on a "user_id" field. He includes the SQL to create the two tables and helps you get the library installed (via Composer). He shows some basic select operations using the fluent interface including where clauses, order by and group by handling. He also covers some basic examples of the other CRUD operations (create, read, update, delete) before getting into one of the more advanced features: the join query builder. Finally, he wraps up the post with a brief look at the query debugger, making it a bit simpler to tell where the failures might lie.

0 comments voice your opinion now!
fluentpdo library introduction tutorial

Link: http://www.sitepoint.com/getting-started-fluentpdo/

Adam Culp:
Fun with Travis CI and PHP projects
July 14, 2014 @ 10:43:53

Adam Culp has a new post to his site sharing some of his fun with Travis CI and his PHP-based applications. He recently started using it and provides a step-by-step guide of how he got started with some handy tips along the way. Travis CI is a continuous integration platform providing processes that run automated testing or other build processes when new commits are made to a repository.

I know I should have done this a long time ago, but I finally got my hands dirty with Travis CI. I wanted to set up a php project on github to use Travis CI to monitor the status, in case I forgot to run the tests prior to pushing. Unfortunately it was not as easy as it's made out to be. But now that I've done it once, it'll be easier next time. So, here is how I tackled it.

He walks you through five (or really six) different steps to getting a build process set up for your repository (complete with screenshots):

  • Create a Travis CI account and link it to your GitHub account
  • Add the repository to connect the build to
  • Make a ".travis.yml" file to configure the build (his runs PHPUnit tests)
  • Validate that PHPUnit runs locally
  • Verify the webhook for Travis CI has been set up correctly

Finally, he includes a bit of description about a successful build and how to add the "badge" showing the current build status to the README of your repository (using Markdown syntax).

0 comments voice your opinion now!
travisci introduction project adamculp guide

Link: http://www.geekyboy.com/archives/908

A
July 07, 2014 @ 16:08:46

On the SitePoint PHP blog there's a new tutorial showing you how to automate your PHP development and deployment with Phake.

As developers, we often have to do repetitive tasks such as updating the database structure, seeding the database, writing CRUD code, running tests, and uploading files to a server. Wouldn't it be great if we could automate these mundane tasks and proceed with solving the more important problems such as making our app more secure or more usable to our users? Phake, an automation tool written for PHP, can do those tasks for you.

They show you how to use Phake (not to be confused with this Phake) including getting it installed via Composer and the creation of a first Phakefile. The include examples of simple tasks, dependencies, grouping, adding descriptions and passing arguments. The command to run the tasks and the resulting output is also included.

0 comments voice your opinion now!
phake automate introduction library

Link: http://www.sitepoint.com/automate-php-phake-introduction/

SitePoint PHP Blog:
Continuous Integration with PHP-CI
July 03, 2014 @ 13:43:22

On the SitePoint PHP blog a new tutorial has been posted from Peter Nijssen showing how to install and configure PHP-CI, a continuous integration library for PHP.

Creating an application is one thing. Keeping it to a certain quality level is another thing entirely. These days, you can find many tools which can help you to keep the quality of your application in shape. Running these tools one by one can be very time consuming. For that, you can install so called continuous integration (CI) services. PHPCI is one of those and in this article, we will dive into it.

The article links you to the latest release and how to install all needed dependencies via Composer. With it set up, they help you add a project and run a sample build. The configuration includes execution of the unit tests, PHP mess detector, PHP code sniffer, CPD, docblock checker and the PHP lines-of-code toolset.

0 comments voice your opinion now!
tutorial continuous integration phpci introduction setup configure

Link: http://www.sitepoint.com/continuous-integration-php-ci/

Rob Allen:
Z-Ray for Zend Server 7
July 02, 2014 @ 12:56:59

In his latest post Rob Allen gives a "first look" at a new feature in the Zend Server (v7) product from Zend - Z-Ray. The z-Ray feature gives you a complete "under the covers" look at what your code is doing including resource use, database connections and processing time.

I've been running the beta for all my development work for a while now and the main reason is the new Z-Ray feature. Z-Ray is a bar that is injected into the bottom of your page showing lots of useful information.

His post shares some of the results he found with his development version of Joind.in and screenshots of the results. He shows the levels of detail available at each level, all directly in the browser. It even includes functionality to track all variables being created or used in the current execution.

0 comments voice your opinion now!
zray zendserver7 introduction joindin example screenshot

Link: http://akrabat.com/software/z-ray-for-zend-server-7/

SitePoint PHP Blog:
How to Install PHP Extensions from Source
June 30, 2014 @ 11:50:22

PHP extensions (from PECL) can be very handy when you need them. Unfortunately, not all distributions come with packages that will install them for you...this is where compiling comes in. On the SitePoint PHP blog Bruno Skvorc has posted a guide to compiling extensions from source to help you get started.

Sometimes it's hard to know which PHP extensions you'll need before you install PHP. In cases where you need to add extensions later on, you might get lucky and the extension could be in the repository of the OS you're using. [...] What if there's no such thing for other extensions, though? In this tutorial, we'll go through installing some custom extensions on Linux systems (and OS X - the process is nearly identical).

He uses a Laravel Homestead instance as a platform for his example and shows the compilation of the MongoDB for PHP driver. He walks you through the process of booting up the VM and getting the environment/required packages installed. He then shows the process for the installation of two different kinds of PHP extensions: internal and third-party. Finally he shows you how to update your configuration, load in the compiled extension and test it (in this case looking at the phpinfo() to ensure it's loaded).

0 comments voice your opinion now!
install extension source compile tutorial introduction

Link: http://www.sitepoint.com/install-php-extensions-source/

SitePoint PHP Blog:
Mock your Test Dependencies with Mockery
June 26, 2014 @ 14:26:58

The SitePoint PHP blog has a new post today by Peter Nijssen showing how to use a library that's an alternative to the internal PHPUnit mock handling. The post shows you how to use Mockery to test your applications and abstract out any outside dependencies.

Although not everyone is doing it yet, testing your application is one of the most essential parts of being a developer. Unit tests are the most common tests to run. With unit tests, you can check if a class behaves exactly like you intended it too. Sometimes, you are using a third party service within your application and it's hard to get everything set up to get this unit tested. That's exactly when mocking comes into play.

He starts with a brief introduction to the concept of mocking before getting into his examples. He shows how to get it installed (via Composer) and how to add it as a test listener to your PHPUnit configuration file. He then gets into an actual example: mocking out an external API dependency for a weather service. He shows a simple one-method mock example as well as a more complex example using a more randomized result rather than just a static one.

0 comments voice your opinion now!
mock unittest phpunit mockery tool introduction tutorial

Link: http://www.sitepoint.com/mock-test-dependencies-mockery/

Acquia Blog:
5 PHP Components every Drupal 8 Developer should know Part 1 - Composer
June 25, 2014 @ 12:04:23

On the Acquia blog there's a new post from Kris Vanderwater, Developer Evangelist, starting off a series of "Five PHP Components Every Drupal 8 Developer Should Know". In this first post he covers something that's more of a tool to deal with components and dependencies - working with Composer.

Drupal 8 has made a lot of changes. Architectural and technical changes abound, but Drupal 8 has also brought social changes. We're not really feeling the full effects of those changes quite yet, but with time, I believe the implications of Drupal 8's new direction will have an amazing impact for the good of our community. A big part of those changes was the decision to adopt outside code. [...] Interoperability is the driving force of this renaissance and that interoperability has been fueled by a combination of: [a few things including] the timely appearance of a tool known as Composer.

He briefly introduces the tool to those not familiar with it and its purpose. He links to some of the installation instructions, both global and local to a single project. He includes an example "composer.json" (to install the popular Guzzle HTTP tool) and running the "install" command. He gets into the directory structure and files that are created as a part of the installation. He also looks more deeply at the classmap file and how that relates to the files downloaded.

0 comments voice your opinion now!
acquia component introduction drupal8 top5 composer

Link: https://www.acquia.com/blog/5-php-components-every-drupal-8-developer-should-know-part-1-composer

Reddit.com:
Hack How to open the black box of Hacklang as a PHP developer
June 25, 2014 @ 11:56:44

In this recent post to Reddit, user JordanLeDoux shares some of the basics behind the Hack language (from Facebook) and making a "first jump" into it and its strong typing handling.

codebase. Having built HHVM, they wanted something that would enforce certain behaviors for developers that didn't rely on IDE's interpreting phpDoc statements. Hack's most interesting and largest function is that it adds optional strong typing to PHP, by examining the tokenized code and ensuring that where declared strong typing is respected.

Example code is included showing the different levels of typing and how to use them in a few example functions. He introduces some of the basic types included in Hack (like int, float and bool) and some of the types unique to Hack (like mixed, tuples, resource and closures). There's a brief look at maps, vectors and sets and a link to more documentation if your interest has been piqued to learn more and make that "first jump".

0 comments voice your opinion now!
hack introduction language facebook tutorial

Link: http://www.reddit.com/r/PHP/comments/28wn7j/hack_how_to_open_the_black_box_of_hacklang_as_a/


Community Events





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


install community unittest laravel introduction framework threedevsandamaybe podcast list release series opinion developer configure symfony2 interview testing code refactor language

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