 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Generating One-Time Use URLs
by Chris Cornutt April 10, 2013 @ 11:18:56
On PHPMaster.com there's a new tutorial posted showing you how to generate one-time use URLs that could be used for various things across an application, including things like account verification links.
A one-time URL is a specially crafted address that is valid for one use only. It's usually provided to a user to gain privileged access to a file for a limited time or as part of a particular activity, such as user account validation. In this article I'll show how to generate, implement, and expire one-time URLs.
Included in the post is the SQL to create a sample "pending_users" table that includes a "token" column for storing the generated hash. Code is also included for generating the hash and checking the incoming URL to see if it matches the requested user (and hasn't expired).
As a matter of general house keeping you could write a secondary script to keep expired tokens from accumulating in the database if a user never follows them. The script could be run periodically by an administrator, or preferably set up as a scheduled task or cron job and run automatically.
voice your opinion now!
onetime url tutorial generate unique
Gonzalo Ayuso: Building a Silex application from one Behat/Gherkin feature file
by Chris Cornutt October 22, 2012 @ 08:55:18
Gonzalo Ayuso has an interesting post showing how you can use a Gherkin file (used in tools like Behat) to generate a Silex-based application.
Last days I've playing with Behat. Behat is a behavior driven development (BDD) framework based on Ruby's Cucumber. Basically with Behat we defenie features within one feature file. I'm not going to crate a Behat tutorial (you can read more about Behat here). Behat use Gherkin to write the features files. When I was playing with Behat I had one idea. The idea is simple: Can we use Gherking to build a Silex application?. It was a good excuse to study Gherking, indeed.
He includes the example feature file - one that builds an API that lets you list users, get the information for a specific user and update the user's information. Also included are two simple requests to be made to the API and the actual script that makes the Gherkinn-to-Silex translation possible. You can find the full code on github.
voice your opinion now!
silex gherkin api generate tutorial feature file
Fabien Potencier's Blog: Sami Yet another PHP API documentation generator
by Chris Cornutt May 15, 2012 @ 09:18:49
Fabien Potencier has released a new tool to the open source community today - a documentation generation tool called Sami.
Nowadays, phpDocumentor version 2 is probably the best option out there as it has a good architecture, it works fine, it is extensible, and quite a few big PHP projects is already using it. And that's fine. I don't want to compete with it, I don't want to replace it, I'm just open sourcing some code used by Symfony, Twig, and Silex because I'm not comfortable with closed-source software. And to be totally honest and transparent, I have not released the code before because it was not "good enough".
He gives an example of how to install and use Sami - configuring the directories to parse and setting up a custom theme for the resulting generated documentation (using regular CSS and HTML definitions).
voice your opinion now!
sami generate documentation tool opensource
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
NetTuts.com: Build an Admin Panel with the Fuel PHP Framework
by Chris Cornutt December 13, 2011 @ 10:09:47
Phil Sturgeon (an expert in all things related to the Fuel PHP framework) has written up a tutorial for NetTuts.com about creating a basic admin panel for your application based on the framework. This is the second part of a series looking at Fuel, building on the topics from the first.
In the first part of this series, we took a look at the basics of the FuelPHP framework. In this second-part, we'll be stepping it up a gear and move onto some more advanced topics! We'll be creating an admin panel for our application, cover the common uses of the ORM and use the Authentication package to restrict access.
He walks you through setting up Oil (the command-line tool that comes bundled with Fuel) and using it to create a new application. There's a few steps of configuration to connect to a database and setting up a few access groups (like "Banned", "Guests" and "Administrators"). Oil is used again to create users in the database and to auto-generate a lot of the controller/view code you'll need for the admin tool. He then gets into the more technical parts - updating the current code to be able to do things like using the ORM to fetch database results and being able to add comments to posts.
voice your opinion now!
admin panel fuelphp framework oil generate
Philip Norton's Blog: PHPUnit Skeleton Classes
by Chris Cornutt July 25, 2011 @ 10:34:01
In this new post to his blog, Philip Norton reminds you about a handy feature of PHPUnit, the popular PHP unit testing tool, that can make generating tests for your application simpler - the skeleton class generator.
If you create classes in PHP then you should be unit testing them as much as you can. Setting up unit testing classes for your code can be time consuming and involve a bunch of copying and pasting. Thankfully, PHPUnit comes with a couple of helper functions that allow the creation of unit testing classes automatically, which can save a bit of copying and pasting.
He includes an example of a class named "Spider" and shows both the contents of the class and the resulting test that comes from running "phpunit --skeleton-test" on it. The resulting test has methods for each method in your class and marks them all as incomplete. As Philip notes, this is a good start but should never be relied upon as a test to leave as-is.
voice your opinion now!
phpunit skeleton class unittest generate
DZone.com: PHP UML generation from a live object graph
by Chris Cornutt May 11, 2011 @ 10:19:47
On the PHP On Windows section of the DZone.com site Giorgio Sironi has a new post looking at the process (and script he's created) to create a UML diagram with PHP from a project's current class structure.
Sometimes you need to share a design with your colleagues. You can walk him through the code, and explain which classes and interfaces you created, but there are higher abstracted models that you can show to him to make him grasp the picture quickly. One of these tools is UML, and in particular class diagrams.
His script creates a UML diagram from a PHP object graph, a sort of "reverse engineering" of the current object's hierarchy and relationships. It creates definitions that Yuml.me can use to generate the image and does some handy things like following the path down N levels until it hits "the bottom" and the ability to ignore certain namespaces (like "Zend_" or "Doctrine_") to help limit things down to just your application. He includes a sample set of tests to show it in action as well as a resulting UML diagram generated from the PHPUnit structure.
voice your opinion now!
uml generate github object live graph
|
Community Events
Don't see your event here? Let us know!
|