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

Taha Shashtari:
A Gentle Introduction to Testing in PHP
Feb 02, 2016 @ 16:11:20

If you're not already doing testing (like unit testing) in your PHP-based applications but want to start, this new post on Taha Shashtari's site might just be for you. It provides a "gentle introduction" to unit testing, what it is and some of the tools you can use to get started.

Learning testing can be very overwhelming especially if you're just starting out. [...] You might have read a bunch of PHPUnit tutorials and maybe you tried to apply some of what you've learned in your projects, but it doesn't always feel right. And sometimes you get into situations where you have no clue how to test some feature in your application.

If anything of this happened to you, don't feel bad, we all have had this experience. And it's almost because of the way we learn it.

He starts by talking about some of the main goals of testing in your application and the difference between manual and automatic testing. He then gets into each of the three main testing types and follows it with links (and summaries) to tools you can use to get started testing. He ends the post with a brief look at test-driven development and, setting the stage for the next tutorial in the series, looks at the path ahead.

tagged: tdd definition basic introduction gentle testing unittest phpunit tools summary

Link: http://taha-sh.com/blog/a-gentle-introduction-to-testing-in-php

NetTuts.com:
WP REST API: Setting Up and Using Basic Authentication
Jan 08, 2016 @ 17:37:58

On the NetTuts.com site there's a tutorial posted showing you how to set up and use basic authentication in the WordPress REST API. This is part two in their series introducing the WordPress REST API.

In the introductory part of this series, we had a quick refresher on REST architecture and how it can help us create better applications. [...] In the current part of the series, we will set up a basic authentication protocol on the server to send authenticated requests to perform various tasks through the REST API.

They talk about the methods that are available for authentication and how to configure your server and WordPress instance to use it. From there they show how to make authenticated requests to the API using various tools:

  • Postman
  • a Javascript framework (jQuery)
  • the command line via curl
  • using the WP HTTP API

Example code and screenshots are provided for each (where appropriate) helping to ensure you're up and working quickly.

tagged: wordpress rest api tutorial authentication basic postman javascript commandline

Link: http://code.tutsplus.com/tutorials/wp-rest-api-setting-up-and-using-basic-authentication--cms-24762

Dylan Bridgman:
Building a basic router
Aug 14, 2015 @ 14:37:45

Dylan Bridgman has posted a new tutorial talking about building one of the key pieces of any framework (and most applications) to help get requests to the right place - a basic routing system.

There is always value in learning about the internals of the frameworks and libraries we use. It allows for a deeper understanding of the problem being solved and appreciation of the work that has gone into these projects. So today I will be building a basic router to explore this fundamental part of even the smallest framework. The idea is not to create something complete or production-ready but rather the minimum set of features needed to be considered a router.

He creates a simple script that handles both static and variable routes as well as throw an error when a route match isn't found. He starts off talking about the structure of URLs and shows the setup of a rewrite rule to forward all requests to an index page (where the router lives to handle them). Then he talks about the structure of the routing table and how to structure the route-to-action formatting. He opts for a simple PHP array with a closure as the action portion as a starting place. He shows how this is useful for static route matching but upgrades to regular expression matching (passed through a preg_match) to allow variables.

tagged: basic router framework static variable regularexpression regexp

Link: https://medium.com/@dylanbr/building-a-basic-router-b43c17361f8b

BitExpert.de Blog:
Composer, Bower and HTTP Basic Auth
Dec 27, 2013 @ 17:16:23

Stephan Hochdörfer has shared a handy tip for the Composers users out there that may have to deal with username/password protected repositories as a part of your package install process. In his post he shows how to use a simple "expect" script to automatic the HTTP Basic Auth login.

A couple of months ago when we set-up our own internal Satis repository to host our custom Composer packages. We ran into an "unpleasant" issue with Composer that had this PR as an result. To sum things up: We are using HTTP Basic Auth to password-project our Satis repository. There was no way we could switch to an SSL client certificate to allow Composer to authenticate itself automatically without asking for a password. Asking for the password on a developer`s machine is no big thing, but it since we need an automated Composer run in our Jenkins environment, there was no way to set things up.

As Composer doesn't currently support this functionality, they had to find a way around it. They went with an expect script that is used to work with the prompts and send the username/password information when expected. He also points out that this could be useful for other situations and tools - like a Bower build.

tagged: composer satis username password http basic authorization bower expect

Link: http://blog.bitexpert.de/blog/composer-bower-and-http-basic-auth/

PHPMaster.com:
Understanding HTTP Digest Access Authentication
May 21, 2013 @ 17:09:02

On PHPMaster.com they've posted a new tutorial by Sean Hudgston that helps you understand HTTP digest authentication, a simple way to authenticate a user or script against your application.

Digest Access Authentication is one method that a client and server can use to exchange credentials over HTTP. This method uses a combination of the password and other bits of information to create an MD5 hash which is then sent to the server to authenticate. Sending a hash avoids the problems with sending a password in clear text, a shortfall of Basic Access Authentication.

He starts out by looking at the "basic authentication" mechanism that's built into most web servers and points out that it has a major flaw - sending the username/password in (pretty much) plain text. Digest, on the other hand, uses a MD5 hash created from a few pieces of information including username, realm and request method. The result is sent as a header back to the server that can then be parsed by PHP. He also talks about improving on the basic version of the digest method using the qop, nc, and cnonce optional parameters.

tagged: http digest authentication tutorial basic hash

Link: http://phpmaster.com/understanding-http-digest-access-authentication

SitePoint.com:
OAuth for PHP Twitter Apps, Part I
Sep 03, 2010 @ 15:53:45

On the SitePoint blogs today there's a new tutorial posted, the first part of a series, from Raj Deut about making the move away from the basic authorization for connecting to the Twitter API and towards their new OAuth method for Twitter Apps.

As of August 31, Twitter's HTTP Basic Authenticated API service has been disabled entirely. Now, any interface with the API will be required to use a token-based authentication method known an OAuth. [...] At first glance, the task of implementing OAuth can appear daunting, and OAuth's token exchange system can be confusing if you're unfamiliar with it. Fortunately, there are some rather clever individuals who've done the groundwork for us.

They show you how to register your application with Twitter and use the TwitterOAuth library to make a sample connection to their servers. They also show how to generate the tokens for the URL and the ones for accessing the site as a user. With tokens in hand, the script can then connect to the system and make a sample tweet (complete code included).

tagged: oauth basic authentication tutorial twitteroauth library

Link:

PHPBuilder.com:
Upgrading Basic Twitter Authentication to OAuth with PHP
Jun 28, 2010 @ 16:23:09

On PHPBuilder.com today there's a new tutorial about updating your application's Twitter authentication from the basic method to OAuth (which will become the new standard).

Twitter provides an API for developers to build applications on top of it. The API has supported basic authentication over HTTP, but beginning in June 2010 Twitter is discontinuing basic authentication and migrating all Web and desktop applications to OAuth (Open Authorization). Although simpler to implement, basic authentication had its drawbacks. [...] OAuth on the other hand provides a more secure way to authenticate users and allows a persistent access token, which application developers can then consume.

They explain a bit about how OAuth works as compared to the basic authentication method (complete with a graph) and how to use the OAuth Twitter library to make the connection between your application and the Twitter servers.

tagged: twitter authentication oauth basic tutorial

Link:

Chris Jones' Blog:
New PHP Oracle FAQ Wiki
Apr 08, 2009 @ 17:05:05

Chris Jones has pointed out a new wiki page that's been set up as a more centralized resource for frequently asked questions about PHP and Oracle.

I've updated the old Oracle PHP FAQ and the Oracle PHP Troubleshooting FAQs that were hosted by Oracle Technology Network (OTN). We've redirected the old FAQ pages to a new wiki page: http://wiki.oracle.com/page/PHP+Oracle+FAQ with the updated content. Feel free to create an account and make updates. Hosting the FAQ on a wiki seems appropriate because PHP is open source and grows by the value of everyone's contributions.

Questions so far include some of the basics (connecting, querying, etc) and a few more complicated issues like pre-fetching, LOBS and new information for using the Zend Server to connect to your Oracle databases.

tagged: oracle wiki faq basic advanced frequently asked questions

Link:

PHPBuilder.com:
The ABC's of PHP II - What do I need to make it work?
Mar 16, 2009 @ 12:58:31

Peter Shaw has posted the second part of his introductory series to PHP - "The ABCs of PHP". In this new article Peter looks at the installation and configuration of PHP on your platform of choice (Windows or Linux-based).

PHP runs on all the major computing platforms available today, this includes all versions of windows, all the major linux distro's and a lot of specialist systems for devices like the Cobalt Raq and a lot of embedded devices. In this article however we will be concentrating on running PHP under the Apache and IIS web servers, which between the two covers approx 95% of the systems most people will have access to.

He uses packages on the linux installation to make things simple (for a basic Apache2 and PHP5) and the PHP and Apache binaries from each project on the Windows platform.

tagged: abc basic introduction language install apache php5 windows linux package binary

Link:

NETTUTS.com:
Top 50 Wordpress Tutorials
Feb 25, 2009 @ 17:13:30

NETTUTS.com has a list of fifty WordPress tutorials you can use on your installation to do things like:

  • Multiple Wordpress Installations Using a Single Database
  • Wordpress Theme Hacks
  • Turning a Web Template Into a Wordpress Theme
  • Rounded Corner Tab Menus
  • Customizing Widgets Using CSS
  • Wordpress Categories in a Horizontal Drop-down Menu
  • Enabling HTTPS for Wordpress.com Blogs Screencast

Check out the full post for even more WordPress goodness.

tagged: wordpress tutorial list fifty plugin basic theme backend

Link:


Trending Topics: