This document will get you up and running with Apify.
Prerequisites
- Check that you have installed and configured Apache with PHP 5.2 or higher.
- Enable mod_rewrite on your local server.
Installation
Download the .zip or .tar.gz file from the GitHub website and decompress it. Apify offers a starter project that you can download and begin developing in immediately.
Create a virtual host:
<VirtualHost *:80> ServerName mysite.com DocumentRoot /path/to/mysite.com/public <Directory /path/to/mysite.com/public> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
Test your installation by requesting:
GET /example/request GET /example/response.json GET /example/response.xml
Optional
- Create a MySQL database and user/password.
- Import the schema.sql file into your database.
- Open the config.php file and set your database settings.
- Make sure the pdo_mysql PHP extension for MySQL is enabled.
Directory Structure
The directory structure of an Apify web application is standardized to keep things as simple as possible.
project/ app/ controllers/ IndexController.php models/ views/ error/ index/ index.phtml layout/ main.phtml config/ config.php routes.php library/ Request.php Response.php public/ css/ img/ js/ index.php tests/
Here's an example of a Custom Directory Structure (GitHub)
Environments
Apify implements two distinct environments: DEV mode during the development phase and PROD mode when the application is deployed.
You can run an application either in a DEV or PROD mode. You toggle this mode using the DEBUG configuration setting. When DEBUG is set to true, Apify will display exceptions and errors (E_ALL and E_STRICT) in the browser. The PROD mode is fully optimized for production.
Comments
Use this form to add corrections, additions and suggestions about the documentation on this page. If you encounter any problems, please use the GitHub issue tracker.