News Feed
Sections




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

Jonathan Wage:
Using the Symfony Expression Language for a Reward Rules Engine
May 28, 2015 @ 10:07:27

Jonathan Wage has a new tutorial on his site showing you how to use the Symfony Expression Language to create simple logic statements. He illustrates with a project they (OpenSky) applied it on - a "reward" rules engine.

We recently adopted the Symfony Expression Language in the rules engine at OpenSky. It has brought a new level of flexibility to our system and creating new logic has never been easier. [...] The expression language allows you to perform expressions that get evaluated with raw PHP code and return a single value. It can be any type of value and is not limited to boolean values.

He starts with a simple example, showing how it can return a boolean based on the results of an evaluation of an array of data. He then takes this up to the next level and use it with a Doctrine object, evaluating the results of methods to apply "rewards" to a user's account. He shows how to define the Doctrine objects with the necessary methods, how to write the rule and a lookup class to find rules that apply to the current situation.

0 comments voice your opinion now!
symfony expression language rules engine tutorial doctrine object

Link: http://jwage.com/post/76799775984/using-the-symfony-expression-language-for-a-reward

SitePoint PHP Blog:
Pagination with jQuery, AJAX and PHP
May 28, 2015 @ 09:46:57

The SitePoint PHP blog has a new tutorial posted showing you how to set up pagination with jQuery and PHP using a simple Silex-based application.

n this article, we're going to explain how easy it is to paginate your data set using PHP and AJAX via jQuery. We're also going to use the Silex framework for simplicity.

The data he's going to paginate through is a list of "people" data with ID, name and age values. He starts by helping you get Silex installed and a new project created. With that in place, he shows how to inject the database connection (PDO) into the application and set up the simple route to output the "people" data back to the waiting Javascript. The route includes a page number value that's used in the LIMIT statement to segment the results into pages. He also includes another route that returns a total count of people records so the pagination knows when to end. With the backend in place, he then moves to the frontend, showing the complete code to get the page records and populate them into the page (via a list).

0 comments voice your opinion now!
pagination tutorial ajax jquery silex people data

Link: http://www.sitepoint.com/pagination-jquery-ajax-php/

7PHP.com:
Installing Magento version 2 on an AWS (Amazon) Free Tier EC2 Instance On LEMP
May 28, 2015 @ 08:58:05

The 7PHP.com site has a tutorial they've recently posted showing you how to get Magnto 2 installed on an AWS instance running LEMP (Linux, Nginx, MySQL and PHP).

This article tries to demonstrate how to setup an AWS (EC2) instance, installing a LEMP stack, preparing the server environment to meet Magento's requirements and then to finally install Magento v2 using command line approach. [...] I'm presenting in this article something which might otherwise seem to be a daunting approach - but I also see it as an approach which you can later automate by using Docker/Dockerfile for example or even using a Vagrant appliance.

He takes you through the entire process, including the setup of the account and instance on the AWS side, with screenshots along the way:

  • Creating a Free Tier AWS Account
  • Preparing & Configuring your AWS EC2 Instance
  • Creating A Security Group For Our AWS EC2 Instance
  • Creating a PEM file - Key Pairs
  • Creating our AWS EC2 Instance
  • Creating an Elastic IP & Assigning to our EC2 Instance
  • Preparing & Configuring our AWS EC2 Instance
  • Installing Our LEMP Stack
  • The Magento 2 Project Installation Walkthrough
  • Configuring nginx conf file to serve our magento site
  • Creating a database & running The Magento Setup From Commandline

You'll find all the commands, screenshots and output examples you'll need to follow along with the tutorial easily. There's also links to other resources if you're interested in finding out more about the setup.

0 comments voice your opinion now!
commandline magento2 aws ec2 instance install tutorial stepbystep

Link: http://7php.com/installing-magento-v2-aws-ec2-commandline/


NetTuts.com:
Programming With Yii2 Validations
May 27, 2015 @ 11:41:37

NetTuts.com has continued their series around developing applications with the Yii2 framework with this new post covering validations.

In this Programming With Yii2 series, I'm guiding readers in use of the newly upgraded Yii2 Framework for PHP. In this tutorial, I'm going to introduce you to Yii2's validators. Validators simplify the code needed to validate input, i.e. verify conformance or non-conformance of data input, typically from users via web forms. For these examples, we'll continue to leverage the Hello application codebase we've used in past tutorials. Use the GitHub links on this page to get the code.

They start with a brief look at what the validators are and some common uses (and how they can save you time in the long run). There's a list of the current validators included in the framework and how/where they fall in the overall process flow. Then the tutorial gets into the application of a validator, showing how to define the rules, display errors associated with them and application to a "Sample" model and form. This includes the use of the FilterValidator, DefaultValueValidator and SafeValidator.

0 comments voice your opinion now!
yii2 series tutorial programming validators

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-validations--cms-23418

QaFoo Blog:
Developers Life is a Trade-Off
May 27, 2015 @ 10:57:57

In a new post from the QaFoo blog they talk about a developer's life as a trade-off, the amount of work to put into one technology or approach before deciding it's not worth the trouble and moving on.

At Qafoo, we train a lot of people on topics like object oriented software design, automated testing and more. [...] There is no silver bullet and one of the most important skills every developer needs to hone is to assess possibilities and to find the best trade-off for the current challenge.

He uses personal experience to illustrate the point, a struggle they had with choosing a storage system for their application's data. While one technology seemed to be an ideal fit (Cassandra) the trouble it caused made them fall back to something more reliable. He also talks about another instance where he had to make a decision around using a state machine...or not, because of the overhead and time consumed around it.

One of the most important tasks of a developer is to make trade-offs. They occur wherever you look in your every day life. It is a highly important step to realize and accept this. And it is important to hone that skill. You need to open your mind for new technology and techniques, learn and try them wherever you can. But then you need to step back, analyze the current situation and then find the best trade-off between all possible approaches.
0 comments voice your opinion now!
developer life opinion technology tradeoff decision

Link: http://qafoo.com/blog/075_developers_life_trade_off.html

Christopher Pitt:
Making Dependable #2 (Series)
May 27, 2015 @ 09:25:01

Christopher Pitt has posted the second part of his series about creating "Dependable", a Laravel-based application with a focus on Composer use and customization. In part one he laid the foundation, creating a new project, database and setting up migrations to create the tables. In part two he builds on this and creates additional functionality to store a GitHub user's repositories.

One of the ideas we've had is to create an application; which can build a custom Composer dependency map, and deploy that to a new server. It would also be great if there was an interface for deciding which dependencies are included, and a unique URL for each installation.

He starts with a brief mention of testing and why he hasn't included that in his current work. Then he gets into the new models for storing repositories and the migration to create the matching table. He also includes the code that will be needed to link a Developer to a Repository. He finishes the post with an endpoint that can be called to refresh the data from GitHub and pull the repository information down and populate it into the database.

0 comments voice your opinion now!
tutorial series part2 dependable laravel github repositories developer

Link: https://medium.com/laravel-5-tutorials/making-dependable-2-36411b64b958

D
May 27, 2015 @ 08:39:26

Hannes Van De Vreken has posted a tutorial to his site showing users of the Symfony Console component how to show progress on a stream using the ProgressBar helper and a bit of code to inspect the stream itself.

With PHP you can, next to handling HTTP requests, invoke scripts from the command line. [...] The Symfony console component is a very useful tool to define and invoke these kind of CLI tasks. [...] What is actually printed on the console is very important for the issuer of the task. Think of it as the command's usability. Too little runtime information, the less usable the task. [...] Enter the ProgressBar. The ProgressBar is an output helper that wraps the OutputInterface object.

He talks briefly about how the ProgressBar helper works in the console component's output and gives a simple example of the output. He then shows how to hook it into a bit of PHP using the stream_notification_callback optional parameter (defined in stream_context_create) to point to another class method that handles the progress bar updates. It performs a bit of introspection on the stream and updates the progress as its contents progress. He does point out a few caveats though, including that the transfer is not made asynchronous by this handling.

0 comments voice your opinion now!
symfony console stream progress progressbar helper tutorial

Link: https://hannesvdvreken.com/2015/05/12/stream-progress/

Community News:
Recent posts from PHP Quickfix
May 27, 2015 @ 07:05:28

Recent posts from the PHP Quickfix site:
0 comments voice your opinion now!



Binary Studio Blog:
Definitive Guide On Creating Custom Providers For Laravel OAuth2 Authorization
May 26, 2015 @ 12:45:12

A new guide has been posted showing you how to create custom OAuth2 providers for your Laravel application. In this case they wanted to hook the application in via Socialite to the VK social network but needed a custom connector to make it happen.

First of all let's say that social authorization is very popular and frankly speaking it's really handy tool. Surfing internet we can see a lot of sites and services which offer login with Facebook, Twitter, Google and other social networks. [...] If you're building your website in PHP using Laravel, probably you've noticed Socialite which provides OAuth / OAuth 2 authentication with Facebook, Twitter, Google, and GitHub. The most famous social network which provides OAuth2 authentication in Russian segment of the internet is vk. But there is a lack of such connector (provider) in Socialite library. Actually it's not a hard problem, so let's build new VkProvider on top of Socialite's components.

He starts with a brief look at the typical OAuth2 authentication flow between the social network and your application. From there it gets more vk.com specific. He shows how to set up the custom application on their side, updating your configuration with the credentials and installing Socialite. He then implements a "VkProvider" defining the required methods based on the interface. He then registers it as a "SocialiteServiceProvider" and uses it in a "login" request route.

0 comments voice your opinion now!
oauth2 guide custom provider laravel socialite tutorial vkcom russian

Link: http://binary-studio.com/2015/05/25/laravel-oauth2/


Community Events

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


configure opinion series podcast php7 framework introduction language conference part2 voicesoftheelephpant interview example performance symfony2 api laravel release community application

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