Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Archive for Maj, 2015

Site News: Popular Posts for the Week of 05.29.2015

Site News: Popular Posts for the Week of 05.29.2015Popular posts from PHPDeveloper.org for the past week:

Source: http://www.phpdeveloper.org/news/22764

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Jonathan Wage: Using the Symfony Expression Language for a Reward Rules Engine

Jonathan Wage: Using the Symfony Expression Language for a Reward Rules Engine

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.

Link: http://jwage.com/post/76799775984/using-the-symfony-expression-language-for-a-reward
Source: http://www.phpdeveloper.org/news/22763

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

SitePoint PHP Blog: Pagination with jQuery, AJAX and PHP

SitePoint PHP Blog: Pagination with jQuery, AJAX and PHP

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).

Link: http://www.sitepoint.com/pagination-jquery-ajax-php/
Source: http://www.phpdeveloper.org/news/22762

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

7PHP.com: Installing Magento version 2 on an AWS (Amazon) Free Tier EC2 Instance On LEMP

7PHP.com: Installing Magento version 2 on an AWS (Amazon) Free Tier EC2 Instance On LEMP

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.

Link: http://7php.com/installing-magento-v2-aws-ec2-commandline/
Source: http://www.phpdeveloper.org/news/22761

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Site News: Blast from the Past – One Year Ago in PHP

Site News: Blast from the Past – One Year Ago in PHPHere’s what was popular in the PHP community one year ago today:

Source: http://www.phpdeveloper.org/news/22760

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

NetTuts.com: Programming With Yii2: Validations

NetTuts.com: Programming With Yii2: Validations

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.

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-validations–cms-23418
Source: http://www.phpdeveloper.org/news/22759

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

How to use the Flickr Photo Search API

How to use the Flickr Photo Search APII have found one of the best places to find pictures to use on my websites is Flickr. They make it fairly easy to automatically embed Flickr photos onto your website using the Flickr photo search. This Flickr API tutorial will show you how to use the Flickr API to retrieve and display Flickr photos […]


Source: http://feedproxy.google.com/~r/WebDevelopmentBlog/~3/B7-60LOH0zs/

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

How to use the Flickr Photo Search API

How to use the Flickr Photo Search APII have found one of the best places to find pictures to use on my websites is Flickr. They make it fairly easy to automatically embed Flickr photos onto your website using the Flickr photo search. This Flickr API tutorial will show you how to use the Flickr API to retrieve and display Flickr photos […]


Source: http://feedproxy.google.com/~r/WebDevelopmentBlog/~3/B7-60LOH0zs/

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Marc Aube: Design Pattern: Specification

Marc Aube: Design Pattern: Specification

Marc Aube has a new post to his site that introduces you to the specification design pattern, a technique that’s useful for ensuing the current state of an object is valid.

The specification pattern is a software design pattern used to codify business rules that state something about an object. These simple predicates determine if an object’s state satisfies a certain business criteria. They can then be combined to form composite specifications using logical operators. Use a specification to encapsulate a business rule which does not belong inside entities or value objects, but is applied to them.

He suggests a few things the pattern could be useful for like validating the current state or define how an object should be created. He gives a few more “real world” examples and then gets into the code to create a custom specification. In his “CustomerIsPremium” spec he defines a single method on an interface to determine if the Customer given is correct. He then creates a class instance and encapsulates the logic inside its “isSatisfiedBy” method. He also includes a bit more complex example, showing how to create a composite specification for handling grouping like “and”, “or” and “not” assertions. Finally he looks at how to build specifications that can be passed in and used as selection criteria. He does point out that this can leak database handling into the specification layer, however, and should really be avoided without a inversion of control method in place.

Link: http://marcaube.ca/2015/05/specifications/
Source: http://www.phpdeveloper.org/news/22748

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Marc Aube: Design Pattern: Specification

Marc Aube: Design Pattern: Specification

Marc Aube has a new post to his site that introduces you to the specification design pattern, a technique that’s useful for ensuing the current state of an object is valid.

The specification pattern is a software design pattern used to codify business rules that state something about an object. These simple predicates determine if an object’s state satisfies a certain business criteria. They can then be combined to form composite specifications using logical operators. Use a specification to encapsulate a business rule which does not belong inside entities or value objects, but is applied to them.

He suggests a few things the pattern could be useful for like validating the current state or define how an object should be created. He gives a few more “real world” examples and then gets into the code to create a custom specification. In his “CustomerIsPremium” spec he defines a single method on an interface to determine if the Customer given is correct. He then creates a class instance and encapsulates the logic inside its “isSatisfiedBy” method. He also includes a bit more complex example, showing how to create a composite specification for handling grouping like “and”, “or” and “not” assertions. Finally he looks at how to build specifications that can be passed in and used as selection criteria. He does point out that this can leak database handling into the specification layer, however, and should really be avoided without a inversion of control method in place.

Link: http://marcaube.ca/2015/05/specifications/
Source: http://www.phpdeveloper.org/news/22748

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>