This document will give you a brief overview of the ItemManager API, including how to download and use it.

Install

Get up and running in 2 steps:

  1. Under the repository name, click clone or download.
  2. Include imanager.php in your script.

File Structure

The file structure of ItemManager is not completely created yet and I am still making some changes...

your-project
│   .htaccess
│   imanager.php
│   index.php
│   README.md    
│
└───data
│   │
│   └───backups
│   │   │   your-backup-files
│   │   │   ...
│   │
│   └───cache
│   │   │   your-chache-files
│   │   │   ...
│   │
│   └───datasets
│   │   │   contents
│   │   │   ...
│   │
│   └───logs
│   │   │   system-logs
│   │   │   ...
│   │
│   └───settings
│   │   │   custom-settings
│   │   │   ...
│   │
│   └───uploads
│       │   uploaded-files
│       │   ...
│
└───imanager
    │   imanager-core-files
    │   ...

Configure ItemManager

Before you start using ItemManager, you must set appropriate file permissions to allow ItemManager access and write into the complete data/ directory except data/config folder.

It is recommended the 755 permission for writable directories and 644 permission for writable files, as a starting point.

Please be careful with file permissions like 777 or 666. Those permissions effectively make the files readable and writable to all accounts on the server.

.htaccess file

Please make sure that the .htaccess file that comes with ItemManager, is located in the root directory – it's usually where your imanager.php file is locaded.

Note: In order for .htaccess file to work and run, AllowOverride directive must be enabled.

Global config

When you run ItemManager, your project-specific configuration settings can be included during execution. You can add your configuration entries into the custom.config.php file. By default there is no custom.config.php file in your /your-project/data/settings/ directory, you have to create it first. The directory /your-project/imanager/inc/ contains a config.php file (This is the default configuration file and should not be changed). You will need to make a copy of this file, place it in the /your-project/data/settings/ directory and re-name it to custom.config.php, that one will take priority over default ItemManager settings. Now, you can modify all variables listed in the custom.config.php suit your needs.

Design

The basic architecture of ItemManager is based on the following 3 main objects:

  1. Categories
  2. Fields
  3. Items

The Categories represent a kind of initial model, each Item or Field you create must belong to a specific category. The fields are used to determine the properties of items in a category and to control the input, storage and output of the content. ItemManager's fields actually consist of two separate entities: field and input. There are several field types that you can use to customize your items according to your needs.

The probably best approach to understand the concept of ItemManager is to compare it to a database. So imagine the categories are tables, the fields are columns and items are the datasets contained in the tables.


Take a look at the example of the Users category:
id username email password
1 user-1 user-1@mail.com ...
2 user-2 user-2@mail.com ...
3 user-3 user-3@mail.com ...
To be able to work with the users, we first access the category (table):
$users = $imanager->getCategory('name=Users');
In the next step we have the access to the specific user data:
$user = $users->getItem('username=user-2');
echo $user->email;

 

Let's start with the proper tutorial.