 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
9Lessons.info: Login with Instagram OAuth using PHP
by Chris Cornutt May 23, 2012 @ 08:46:46
On the 9Lessons blog there's a recent tutorial showing you how to log into Instagram via OAuth with the help of their Instagram class.
The very quick registration gives you many users to your web project, we already published login with Facebook, Twitter and Google Plus now time to think about very popular photo sharing portal Instagram. This post explains you how to login with instagram Oauth API and importing user data. Create an instagram account and take a quick look at this demo thanks!
The tutorial walks you through the process of setting up an application in the Instagram service, configuring the scripts with the API key/secret and callback as well as the code for a simple login page. They've also included code to grab the user's information and "popular media" from the web service and pull that information into a local MySQL database.
voice your opinion now!
instagram oauth class tutorial popular media mysql
Sebastian Göttschkes' Blog: Testclasses for symfony2
by Chris Cornutt April 13, 2012 @ 11:57:53
Sebastian Göttschkes has a new post to his blog about a set of abstract base testing classes he's developed to help with the functional, unit and validation testing of his Symfony2-based applications.
So, when developing with symfony2, I rely on my tests. They are my safety net and without them, I get a little nervous after every change. Does everything work? Did I forget anything? So I developed some classes which I extend. They work on top of PHPUnit and the symfony2 WebTestCase. The classes are used by my different types of Tests: UnitTests, ValidationTests, FunctionalTests (as well as IntegrationTests).
Code for each type of testing base class is included in the post showing how he extends the based PHPUnit test case for unit testing and the Symfony WebTestCase for validation and functional testing. Each one of the classes are ready to use and give you some handy helper methods too.
voice your opinion now!
testing abstract class validation unittest functional
Refulz Blog: Traits in PHP 5.4 - Why we need Traits
by Chris Cornutt March 30, 2012 @ 11:53:35
On the Refulz blog today there's a new post about traits in PHP (recently introduced in PHP 5.,4) and why we need them in our development.
Traits is one major addition to PHP. We read an introductory article about Traits in PHP 5.4. In the post, we saw an example code which only resembles single inheritance. So, what is the actual purpose of Traits and why do we need to use Traits in our code.
They give a sample use case involving two types of clients, Business and Individual, and how you can use a single Client class and trait to provide address-related functionality.
voice your opinion now!
traits introduction example class tutorial
Chris Hartjes' Blog: Metatesting Understanding Mock Objects
by Chris Cornutt March 28, 2012 @ 08:19:20
In this new post to his blog Chris Hartjes gets into some details about some complex mocking he recently had to do in a project for work. He includes code snippets to illustrate.
With such an extensive array of tests [at work], I have received an education in what it really means to write unit tests for live, production-ready code that really takes unit testing seriously. [...] If you are really writing your unit tests the way you should, each test is focusing on testing one bit of functionality in isolation, which means that you will be heavily relying on mock objects to make things work. I've come up with an example scenario that I hope goes a long way to explaining how to effectively use mock objects.
In his example, he shows how to mock out two objects, "Foo" and "Bar" that are passed into a method in his "Alpha" class. He looks at the code for the "Foo" class and creates a mock object based on its contents - two methods: "getId" and "getDetails". He does the same with the "Bar" class, mocking the "getStartDate" and "getEndDate" methods and showing how to pass those into the "munge" method on the "Alpha" class, complete with return values to match the tests.
For more information on PHPUnit's mock object support, see this page in its manual. You might also explore another popular option, Mockery.
voice your opinion now!
mock object unittest phpunit class tutorial
PHPBuilder.com: Error Handling in PHP 5
by Chris Cornutt March 07, 2012 @ 13:37:12
New on PHPBuilder.com today Leidago Noabeb gives you a pretty comprehensive overview of error handling in PHP - everything from the types of errors to how to control which are output in which environments.
In this article we will be looking at how to handle errors in PHP. Errors are an inevitable part of software development, and accordingly, we will be looking at the various error types and demonstrating how to handle them. If you intend to run any of the sample scripts in this article, please make sure that display errors is turned on in your PHP initialization document (php.ini).
The article talks about the types of errors PHP uses (syntactical, runtime and logical) and shows how to handle some of the most common issues with them. It also talks about the different error reporting levels (ex. E_ALL, E_WARNING, E_STRICT) and includes the code for a simple error handler class that switches off and handles each type differently.
voice your opinion now!
error handling class example levels tutorial
Code2Learn.com: Generating PDF files from Database using CodeIgniter
by Chris Cornutt February 29, 2012 @ 12:07:33
On the Code2Learn blog there's a recent tutorial about creating PDFs from CodeIgniter using the R&OS PDF class (not bundled with the framework, but easy to integrate).
As a programmer I find PDF files very helpful to me when generating reports and getting them printed. We will be using R&OS pdf class. I find this to be the best one because all others libraries I came across didn't offer me a good control over the making of the file and also the process of making i.e the code required for this library is bit tricky but it helped me improve my coding.
Code is included to create a simple PDF helper class that creates a new "cezpdf" object and add some basic things like titles, page numbers and some basic footer text. A simple controller is included that pulls the information from a database table (in their case a record of logins) and pushes this data into the PDF as lines of text.
voice your opinion now!
codeigniter framework pdf class helper pdf generate database
PHPMaster.com: Under the Hood of Yii's Component Architecture, Part 1
by Chris Cornutt January 31, 2012 @ 11:19:47
On PHPMaster.com today Steven O'Brien takes a look at a popular PHP-based framework, Yii - specifically one of the components that makes it up, the CComponent that provides a base for all other components in the framework.
There's been a lot of buzz surrounding the use of frameworks for quite a while now and there are many great PHP frameworks to choose from. I was blown away by the simplicity and power of the base CComponent class in the Yii framework. [...] Every class in the framework extends from the CComponent class, which means that all subclasses work as components and can raise and handle events as well as be reusable and configurable. This packs a lot of punch for such a little class!
In this first post of the series, he looks at how this base class lets you work with class properties using the magic getters and setters. He includes some code showing how to set them up and how to use it to configure your object by passing in other component and their configuration.
voice your opinion now!
yii component tutorial ccomponent class introduction framework
Lorna Mitchell's Blog: Building A RESTful PHP Server Routing the Request
by Chris Cornutt January 23, 2012 @ 11:14:11
Lorna Mitchell is back with a second installment in her "Building a RESTful PHP Server" series with this new post about handling and routing the incoming requests. (You can find the first part about working with the request here)
This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.
She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction"
methods for responding to GET and POST requests.
voice your opinion now!
restful server tutorial request routing controller get post action
DevShed: Effects of Wrapping Code in Class Constructs
by Chris Cornutt December 29, 2011 @ 10:06:58
DevShed has a new tutorial posted today looking to help you counteract the bad practice of wrapping procedural code in "class" constructs and provide some useful suggestions of how to avoid it.
Static helpers seem to be a great idea at first glance, as they're reusable components that don't require any kind of expensive instantiation for doing common tasks [...]. But the sad and unavoidable truth is in many cases they're simply wrappers for procedural code, which has been elegantly hidden behind a "class" construct. So what's wrong with this? Well, even in the most harmless situations, when you use a static helper that produces a deterministic output, you're actually throwing away the advantages that OOP provides.
To illustrate, they create a basic validation class that can check for things like valid emails, float values, integers and URLs using PHP's filter_var function. They point out that the class is difficult to extend and that it is doing too many things to be correctly considered a "piece" of functionality. To correct the problem, they opt for a different approach - an abstract class acting as an interface to structure custom validators against. This provides set/get methods for things like the error message and value to evaluate. The implementation of the validators on top of this class is coming in the next part of the series.
voice your opinion now!
tutorial constant static method interface abstract class
|
Community Events
Don't see your event here? Let us know!
|