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

E
December 19, 2014 @ 11:56:41

On the SitePoint PHP blog a new tutorial has been posted showing you how to effectively search Chinese content with ElasticSearch. ElasticSearch is a "powerful open source search and analytics engine that makes data easy to explore" and plays nice with PHP via a JSON based query format.

If you have played with Elasticsearch, you already know that analyzing and tokenization are the most important steps while indexing content, and without them your pertinency is going to be bad, your users unhappy and your results poorly sorted. Even with English content you can lose pertinence with a bad stemming, miss some documents when not performing proper elision and so on. And that's worse if you are indexing another language; the default analyzers are not all-purpose. When dealing with Chinese documents, everything is even more complex, even by considering only Mandarin which is the official language in China and the most spoken worldwide.

He starts by explaining exactly what the problem is with searching Chinese content including the fact that some words can actually be a combination of two or more characters (words). He then lists out a few plugins and tools that can be integrated with ElasticSearch to help with analyzing the content. He goes through each of them and provides instructions on installation and usage. He ends the post with a sample of the results for a set of three search terms, comparing the matches each found.

0 comments voice your opinion now!
chinese search elasticsearch tutorial tokenization analysis

Link: http://www.sitepoint.com/efficient-chinese-search-elasticsearch/

Matthieu Napoli:
Test against the lowest Composer dependencies on Travis
December 18, 2014 @ 10:53:58

Recently the "prefer-lowest" option of Composer was mentioned in relation to testing for Symfony-based applications. In this new post to his site Matthieu Napoli shows how you can do it on any project that uses the Travis-CI continuous integration service.

Composer just got a new awesome addition thanks to Nicolas Grekas: prefer the lowest versions of your dependencies. [...] This amazing option will install the lowest versions possible for all your dependencies. What for? Tests of course!

He includes all the instructions you'll need to get your Travis build using this command line option, starting with testing it on your own system first. He shows a basic ".travis.yml" file with the configuration you'll need to provide it use the "prefer-lowest" (check out line 17). He does point out that you'll need to run a "composer self-update" first though, as Travis hasn't quite caught up with the latest Composer that includes this option.

0 comments voice your opinion now!
test lowest dependency version composer travisci tutorial

Link: http://mnapoli.fr/test-lowest-dependencies/

SitePoint PHP Blog:
Getting Started with Medoo - Examples of Use
December 18, 2014 @ 09:45:26

On the SitePoint PHP blog, there's a new tutorial that introduces you to the Meedoo library, a tool to make working with databases even easier. In this tutorial Wern Ancheta walks you through some of the basics of the tool and shows you how to use it with a Pokemon-based example.

In this article I'm going to walk you through Medoo, a lightweight database abstraction library for PHP. Its main features include: support for multiple databases, being secure and easy to use. [...] While Medoo is nothing revolutionary, and the fact that it sports a very small filesize matters little to few, it's still an interesting project that went from being outright dismissed to vaguely accepted, as evident in these threads. It's on its way up, and that's our reason for taking a look at it.

Once installed (he recommends using Composer) you can follow along with his examples showing how to connect to the database, make a simple select and define something a bit more complex (like multiple other requirements in the SQL statement's "where"). He shows how to execute manual queries and handling more complex operations like joins. He then gets into the other parts of the usual CRUD handling - inserting new data, updating data and deleting data.He finishes the post by mentioning aggregate functions and some of the debugging options the tool includes.

0 comments voice your opinion now!
medoo database tutorial library tool crud complex

Link: http://www.sitepoint.com/getting-started-medoo-examples-use/

Sameer Borate:
Integrating Googles new reCAPTCHA in PHP
December 17, 2014 @ 09:23:10

Recently Google announced their reCAPTCHA without a CAPTCHA technology to help make preventing automated systems (usually spammers) from causing issues in your applications. In this new post from Sameer Borate, he shows you how to implement this new kind of CAPTCHA in your PHP-based application.

For the past several years Google's reCAPTCHA has helped verify that a user is not a bot by forcing you to decipher warped text. reCAPTCHA's method of protecting websites from spam has always been a kind of burden on the end user who has to solve the captcha to prove that he is human and not a bot. [...] Google recently released a new captcha API called "No CAPTCHA" reCAPTCHA, which utilizes an Advanced Risk Analysis engine that is capable of discerning between users and bots. So instead of solving a jumbled box of text all a user has to do is check a box.

He walks you through the full process of the integration:

  • Signing up for an account/API keys
  • Rendering the HTML for the actual widget (using Google Javascript)
  • Validating the user's response via an API call
  • The PHP you'll need to perform the validation

He also briefly mentions some of the customization available and provides the code as a download so you can see it all working together.

0 comments voice your opinion now!
google captcha nocaptcha recaptcha api tutorial configure setup

Link: http://www.codediesel.com/security/integrating-googles-new-nocaptcha-recaptcha-in-php/

SitePoint PHP Blog:
AngularJS in Drupal Apps
December 16, 2014 @ 12:23:31

On the SitePoint PHP blog there's a new tutorial posted (by Daniel Sipos) about combining Drupal and AngularJS to make for more front-end focused, responsive applications.

Angular.js is the hot new thing right now for designing applications in the client. Well, it's not so new anymore but is sure as hell still hot, especially now that it's being used and backed by Google. It takes the idea of a JavaScript framework to a whole new level and provides a great basis for developing rich and dynamic apps that can run in the browser or as hybrid mobile apps. In this article I am going to show you a neat little way of using some of its magic within a Drupal 7 site. A simple piece of functionality but one that is enough to demonstrate how powerful Angular.js is and the potential use cases even within heavy server-side PHP frameworks such as Drupal.

He walks you through the creation of a simple addition of a block that lists out the titles of some other nodes. You'll need an existing Drupal installation to follow along (no setup instructions here) as well as an Angular structure for a small application. He starts with the module configuration and creates custom handling to return the JSON result back to the waiting JS connection. Then he creates the custom template and block that the AngularJS will output the results too. Finally, with that rendering, he glues them both together in an Angular controller that loads the results when an "Open" button is clicked.

0 comments voice your opinion now!
angularjs tutorial drupal integrate introduction

Link: http://www.sitepoint.com/angularjs-drupal-apps/

SitePoint PHP Blog:
Writing API Documentation with Slate
December 15, 2014 @ 13:46:59

The SitePoint PHP blog has a new tutorial for the API developers out there showing you how you can use Slate for creating documentation. They point out a few other tools or formats you could use, but focus in on Slate, a Markdown-based tool that converts the result to HTML.

So you've built yourself an API. Perhaps it's RESTful, RESTlike or something else entirely. [...] There's one more thing, however. Thing is, an API is only as good as its documentation. That applies if it's for internal use only - perhaps it's for a JavaScript-based one-page app, or a mobile application - but even more so if it's for public consumption.

He includes an example of what the output looks like first so you know what the end result will be (and if it meets your needs). They then walk you through the installation of Slate and a few Ruby tools you'll need to generate the HTML output. He includes a simple example of the configuration and a simple document with four sections. He also shows how to use includes, alerts, tables and a sidebar. Finally he gives the "rake" command to build the documentation and how to you can push the result up to your own GitHub Pages.

0 comments voice your opinion now!
slate api documentation tutorial install configure example

Link: http://www.sitepoint.com/writing-api-documentation-slate/

Remi Collet:
PHP-FPM in Docker
December 12, 2014 @ 11:57:35

Remi Collet has a new post today showing you how to get PHP-FPM up and running with Docker using a few simple lines in the Dockerfile. Docker is a toolset that lets you easily create and provision containers with scripted configurations (and link them together).

[The] use case [for this is] running php 5.3.3 on a Fedora 20 / 21 development workstation, for production deployment on RHEL-6 (as no php 5.3 SCL exists). This example can be easily adapted for all available PHP versions available as RPM (5.3.3 in RHEL-6, 5.4.16 in RHEL-7, 5.4.16 and 5.5.6 in RHSCL 1.2 or using a third party repository).

The contents of the Dockerfile are included, making a call to yum to install all the needed packages, make a few replacements in the www.conf configuration file and create the default "www" directory. Finally, it fires up the PHP-FPM server with the IP given in the startup. The commands to create the container and launch it are also included in the post.

0 comments voice your opinion now!
tutorial phpfpm docker container create configure

Link: http://blog.famillecollet.com/post/2014/12/11/PHP-FPM-in-Docker

AirPair.com:
Automating Laravel Deployments Using Capistrano
December 12, 2014 @ 09:15:06

On the AirPair site there's a recent post by Vincent Cardillo showing you how to set up Laravel deployments with Capistrano, a popular Ruby-based deployment automation tool.

Hello friends. In this article we will be discussing automating the deployment of Laravel applications using the Capistrano tool. If you don't know what some of these things are, read on. [...] Why should we bother setting up Capistrano? Can't we just deploy to our servers by hand? Sure, maybe, but this quickly becomes annoying with anything more than a few servers, and isn't a scalable process.

He starts by laying out some of the prerequisites you'll need to get the deployment working: a Laravel application installed, some familiarity with Git/GitHub and a Linux-based system to work from. He talks about two methods of deployment, push and pull, and includes a summary (and illustration) for each. From there he starts to get into the detailed steps of setting up the deployment itself:

  • Protecting sensitive information (like configuration files)
  • Installing Capistrano as a Ruby gem
  • Setting up the SSH keys between systems
  • Setting up the receiving server
  • Setting up the Laravel project in a Capistrano deploy
  • Creating the steps in the deployment workflow
  • Doing the actual deployment

He includes all of the commands and configuration examples you'll need to make the deployment happen. He also finishes off with a few other things Capistrano could do for you including making a "sanity check" file and flushing memcache on deploy.

0 comments voice your opinion now!
laravel deployment capistrano tutorial automate

Link: https://www.airpair.com/laravel/posts/automating-laravel-deployments-using-capistrano

Acim.net:
Trait injection in Zend Framework 2
December 11, 2014 @ 11:55:56

Boban Acimovic has recently posted a tutorial showing you how to use traits in a Zend Framework 2 application to inject additional functionality into your pre-existing classes.

There are several tutorials on the Internet which explain how to use interface based dependency injection in Zend Framework 2. The idea is to make an initializer, figure out which interfaces a class implements and then inject appropriate dependencies using setters defined in the interfaces. Bad part about this is that in each class you implement such an interface you have to declare a property which would hold the injected object and also to implement the setter for it, which is defined in the interface, by the way. In order to simplify this further it is possible to write trait for each interface, but then why should not use just traits? Why do we need interfaces? Is this possible at all?

He includes some example code showing how to set up dependency injection for the traits (via a custom injector based on the "InitializerInterface") and make the autoloading easier. He shows how to add this to the provider configuration as an "initializer" and create the first example trait, a checker for data in user passwords. He then drops the functionality into a service class just by using the "use" keyword and the trait name.

0 comments voice your opinion now!
trait injection zendframework2 tutorial dependencyinjection service provider

Link: http://www.acim.net/2014/11/trait-injection-in-zend-framework-2/

KodeInfo.com:
Pay with Bitcoin using Coinbase and Bitpay
December 11, 2014 @ 10:29:09

On KodeInfo.com there's a new tutorial posted showing you how to let your users pay with Bitcoin made possible using Coinbase, a Bitcoin wallet service, and BitPay, a payment gateway. Their example is a Laravel-based application.

Today we will learn how to integrate payment with bitcoins , we will integrate coinbase and bitpay to pay with bitcoins .

They walk you through the full process, including getting the accounts set up on the needed services:

  • Setting up Bitpay
  • Setting up Coinbase
  • Creating migrations
  • Views and Routes
  • Config File
  • Creating models
  • Integrating Bitpay
  • Integrating Coinbase

Each step is accompanied by screenshots or code, depending on what steps are needed. If you want to jump to the end, you can also grab the full code directly from GitHub.

0 comments voice your opinion now!
bitcoin coinbase laravel payment gateway tutorial integrate bitpay

Link: http://kodeinfo.com/post/pay-with-bitcoin-using-coinbase-and-bitpay


Community Events





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


conference framework laravel list version podcast symfony artisanfiles language series introduction security library release voicesoftheelephpant tool interview composer opinion community

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