Welcome to the MVCnPHP Sample Blog


This blog was written using MVCnPHP, a lightweight, powerful Model-View-Contoller (MVC) implementation written in PHP5. While this sample application is very simple it does exercise most aspects of MVCnPHP allowing you to use MVCnPHP very quickly in your own PHP projects.

To test drive this demo simply login with the username 'admin' and password of 'password'. Don't worry about doing any damage, we will purge the blog entries every 30 minutes or so.

Installing MVCnPHP is very simple to use. We have versions for PHP versions prior to 5.3 as well as a version that supports namespaces in PHP 5.3 and later.

Installing MVCnPHP on PHP 5.3 or later

The Apteno PEAR Channel hosts only the PHP 5.3 compatible version. Installing both MVCnPHP and the sample application is easy:

  1. pear channel-discover pear.apteno.net
  2. pear install pear.apteno.net/MVCnPHP-beta
  3. Ensure your PEAR www_dir points to some sane location: pear config-show. If you aren't happy with it's location use: pear config-set www_dir /new/path
  4. pear install pear.apteno.net/MVCnPHP_Sample-beta

You aren't done quite yet. Read the section below on configuration the sample application

Installing MVCnPHP on PHP 5.2.x and prior

First download both MVCnPHP and the sample application then follow these simple instructions:

  1. pear install /path/to/MVChPHP-noNS-0.2.0.tgz
  2. Ensure your PEAR www_dir points to some sane location: pear config-show. If you aren't happy with it's location use: pear config-set www_dir /new/path
  3. pear install /path/to/MVCnPHP_Sample-noNS-0.2.0.tgz

You aren't done quite yet. Read the section below on configuration the sample application

Configure the MVCnPHP Sample Application

  1. Change to the location of your MVCnPHP sample application
  2. mkdir -p data/blog data/logs data/Flexy data/MVCnPHP
  3. chown -R [WebServerUser] data/
  4. cp SAMPLE.htaccess public_html/.htaccess
  5. Edit public_html/.htaccess and change reference to index.php to match your server
  6. Edit config.php and change site_url to match your server
  7. If needed edit your Apache configuration to add a new virtual host

Getting Started with MVCnPHP

After you get it installed you are encouraged to use this sample application as it will demonstrate the MVCnPHP basics. In particular you should:

  • Visit the project website
  • Be sure to view the PHP and Flexy source code by clicking the two icons in the header of every page.
  • You may want to browse the source code of the entire applications. The two icons mentioned above only show you the code for the current view and template so your are missing the models, controller and other classes that make up this applications.
  • Like jQuery? We do too. This sample shows you how to use some of jQuery's features so be sure to check them out.
  • Definitely check out the source for the SampleBaseView class as it is the parent of all views in the sample application and it shows you how to quickly extend functionality in MVCnPHP.
  • Do you like all this? If so you should follow Apteno on Twitter to stay informed on the latest development efforts of this new company.