Hello and welcome to the Phork/it demo!

Phork/it is a starter kit for building websites on top of the Phork Framework.


Phork/it includes both front end and back end enhancements to the core set of functionality provided by the Phork Framework. It's an excellent starting point for both new and experienced users who don't want to reinvent the wheel when it comes to setting up the basic building blocks of a website.

This document only focuses on the Phork/it enhancements and doesn't cover any of the core Phork Framework features.

For more information on how the Phork Framework works, check out the Phork manual.


  1. Download and install the Phork package
  2. Download Phork/it into Phork's sites/ directory (eg. phork/sites/phorkit/)
  3. Copy phorkit/config/example and its contents to phorkit/config/live
  4. Point your server's document root to /path/to/phork/sites/phorkit/htdocs/
  5. Open Phork/it in your browser and follow the instructions

User Management

Phork/it has a fully featured user management system. Users can sign up, log in, log out, create a profile, update account settings, reset lost passwords and verify their email address. There's also a built in roles system, so users can belong to one or more permissioned groups.

Facebook Integration

Phork/it uses Facebook's PHP SDK to allow users to seamlessly sign up and log in using their Facebook account. After a user clicks the button to sign up with Facebook they're redirected to Facebook, and after they've granted the application access they're redirected back to Phork/it to finish the sign up process using the data imported from their Facebook profile.

Phork/it can also post to a user's Facebook wall and let them find and connect with their Facebook friends who've also signed up here. Because Facebook allows granular permissions, Phork/it only asks for the minimum permissions allowed to connect the account. Later on, if Phork/it wants to perform other actions the user will be asked to grant more permissions.

Twitter Integration

Phork/it uses Zend_Service_Twitter from the Zend Framework to allow users to seamlessly sign up and log in using their Twitter account. After a user clicks the button to sign up with Twitter they're redirected to Twitter, and after they've granted the application access they're redirected back to Phork/it to finish the sign up process using the data imported from their Twitter profile.

Phork/it can also post a tweet for the user and let them find and connect with their Twitter friends who've also signed up here.

Friends and Followers

Phork/it comes with the ability to set up both friend and follower relationships. Friendships are reciprocal and require both users' approval (like Facebook), and followers are a one way system and require no approval (like Twitter). The friend and follower system can be used at the same time, or you can choose to just use one system. Also included is the ability to block users.

Event Stream

Phork/it includes an event stream system that can tie into any model's post-save event or act as a standalone system. Anything a user does, from friending or following another user to updating their profile can be posted to the event stream. The events in the stream can be filtered to show just a single user's events, a user's connections' (friends) events, or all events in reverse chronological order.

Profile Pages

Phork/it includes user profile pages with each user's picture, bio, location, and website, as well as their event stream and their friends and followers. There are also buttons to allow a logged in user to friend or unfriend and to follow or unfollow the user. When a user is on their own profile page they can post a status message to their event stream and approve or deny pending friend requests.

Beta Access

Phork/it can be set up to only allow pre-selected beta users to access to the site. Beta users can register with a one-time-use key from the database, or using a shared multi-use key defined in the site configuration file.

API Framework

Phork/it includes a REST API framework that supports XML, JSON and JSONP calls. The API is set up so that your application can use its own API internally without having to make additional HTTP requests. This is accomplished using the ApiHelper utility class. We recommend developing an API concurrently, using internal API calls, and doing all your caching at the API level.

Phork/it also includes a batch API method to allow multiple API calls to be run from a single request. A batch request accepts a post containing JSON data with all the calls to make and the type of call (GET, POST, PUT, or DELETE).

Phork/it comes pre-packaged with fully-featured user, tag and event APIs. These allow you to get user information, request friendships, follow and unfollow users, post status updates, see friends' status updates and much more. Each API call can easily be tuned to require authentication or not.

Try it out now in your shell. Copy and paste the following examples into your terminal (excluding the dollar sign) and watch what happens. Calls with user:pass require your own username and password. Passing raw=1 as an argument for XML calls leaves the results uncompressed.

$ curl -X POST -u user:pass http://phorkit.org/api/events/add/status.json -d "status=This is fun"

$ curl -X POST -u user:pass http://phorkit.org/api/tags/for=user/add/[user id].json -d "tag=Awesome"

$ curl -X PUT -u user:pass http://phorkit.org/api/users/connect/follow/[username].json

$ curl -X PUT -u user:pass http://phorkit.org/api/users/approve/friend/[username].json

$ curl -X DELETE -u user:pass http://phorkit.org/api/events/delete/[event id].json

Javascript Enhancements

Phork/it comes packaged with jQuery and has several utilities built on top of the jQuery library, including overlays and modal windows, a sub-navigation system, several different alert styles, clearable form labels, and email obfuscation techniques. All Javascript is added unobtrusively and is set up to degrade gracefully.


Phork/it comes with an easy to use overlay system. The contents of the overlay can be loaded in via AJAX, built from a template, built with existing page content, or set to use a predefined message. Overlays have the option to be a modal window, which will black out the rest of the page content, or they can float on top of existing content.

The overlay system is currently used for login windows, tooltips, alerts and confirmation dialogs.


Phork/it comes with two different alert styles. Choose from a modal overlay with optional confirm and cancel buttons, or a line item at the top of the page. It's easy to mix and match alerts for the appropriate event.


Phork/it is set up so that any form with the class "ajax" is submitted via AJAX. Forms in overlays and forms in the regular flow of the page can all automatically submit via AJAX.

It's also easy to add labels inside form fields that will clear on focus and come back again on blur if no data has been entered.


Phork comes with three separate debugging handlers - it can log the debugging data to a file, print it to the screen immediately, or save it to a session variable. Phork/it takes advantage of the session-based debugging and integrates it with an AJAX powered debugging system that builds a toggleable overlay at the top of each page with everything that has been run through both the Phork debugger as well as the Javascript console.log() function.


Phork/it makes it easy to send emails to registered users using either PHP's built in mail function, or through a 3rd party's API. It even comes packaged with an optional wrapper for Postmark integration.

Phork/it comes with some basic email templates to auto-respond to certain actions, including emailing the user a link to reset their password, and emailing a user a link to verify their account after they've signed up or changed their email address.

Zend Integration

Phork/it allows your application to seamlessly integrate with the Zend Framework using the ZendLoader extension. It's simple to pull in any number of Zend libraries to enhance your system.

The Zend Framework is optional and isn't required for any core functionality. Currently Phork/it makes use of Zend's Twitter library, Amazon S3 integration, and, if the Zend Framework is installed, it will use the improved Zend_Json encoding and decoding tools instead of PHP's native functions.