I have a whole series of posts, waiting in draft, describing my evolving PHP framework, I call ccPhp. If you have nothing better to do than play with someone else’s dalliances, then here is a quick installation guide. A little backwards, because I’ve yet to publish reasons why you’d want to. But, if, after my eventual publications describe this framework, you decide to install it, this is the quickest place to see how to do that.
The following describes only one way to arrange the setup. I have designed the framework with few cross-dependencies. After my “standard” setup description, I will describe the few file dependencies so that you easily define your own file organization. (If you are on Windows, you can extrapolate the appropriate things to do there).
- Create or choose a working directory, e.g.,
~/work. We will install the framework directory and project directories.
mkdir ~/work cd ~/work
- Get the framework core sources from download and unpack or from the subversion repository.
svn checkout http://svn.cachecrew.co/ccphp/ccphp/trunk ccPhp
The framework can be installed anywhere; the project specific file simply needs to find and include the
ccApp.phpthat is part of the framework.
- Copy the sample_project directory from the ccPhp directory for your project:
cp -r ccPhp/sample_project my_project
This directory will contain a “public” directory with a
index.phpfile which probably won’t need to be changed.
imgs, etc. directories, as needed, in the public directory.
- The public directory needs to be visible to the public; i.e., the web server needs to access this directory. Create a symlink from the web-directory to the public-facing directory. If
~/www/htdocsis the web server’s document root, the following would the project code to be accessed via
cd ~/www/htdocs ln -s ~/work/my_project/public web
The public directory can be, essentially, placed or referenced anywhere in server’s document-root directory hierarchy, as necessary for users to be able to reach your application. If you want the app to be served at the URL root, then the server’s document-root should be pointed to the public directory.
- Customize the
config.phpfor your project.
- Code your application as a series of
ccPageInterfaceobjects. (More about this another time).
Project Organization Flexibility
The framework was designed to support the various styles of file organization that developers prefer. The organization presented above is only one way. The only things that really need to be accomplished:
- The project’s public directory can be located anywhere and called anything, so long as the web server can find it (if, even through a symlink).
- The bulk of the project’s implementation code can be anywhere, so long as the project’s default startup file (i.e.,
index.php) can find the project code.
- The framework can be located anywhere so long as the project’s code can include its
The organization described in this document implements the preceding, by:
- Each project contains a “public” directory that is symlinked from the web servers’ document root directory hierarchy.
- A project contains an initialization
config.phpfile that is included by the
index.phpin the public directory.
config.phpfile includes a reference to the framework’s
ccApp.php. file. The project directories are in the same directory as the framework.
What can you do with this? Follow my other posts about the ccPhp Framework for more information, arriving soon!