Getting started

Getting started

The wCMF project mainly consists of two parts, the application framework and an application template.

wCMF Framework

The wCMF framework provides the infrastructure to create PHP web applications based on the model-view-controller pattern. The project's source code is hosted at GitHub and can be forked or downloaded from there.

If you manage your dependencies using Composer you may want to add the following lines to your composer.json:

{
"require-dev": {
"wcmf/wcmf": "dev-master"
}
}

Default Application

The default application is a fully functional data managing application based on the wCMF framework. Besides interfaces for create/read/update/delete (CRUD) operations on all entity types defined in the domain model, it features user, role and permission management as well as a lucene based search.

The following screenshots show the list and detail view of an Author entity type.

wcmf-default-app1ws.png
wcmf-default-app2ws.png

Prerequisites

To run the wCMF default application you will need the following:

  • Web server (e.g. Apache)
  • PHP
  • MySQL
  • Composer
  • Apache Ant for code generation and deployment

To modify the demo model you additionally need:

Installation

We assume that the application's root directory is accessible to your web server and mapped to the url http://localhost/wcmf-default-app.

GitHub

The application's source code may be cloned from GitHub using the following command:

$ git clone https://github.com/iherwig/wcmf-default-app

After that you should see the following directories:

  • app
    • config
    • locale
    • public
    • src
  • build
  • install
  • model
  • test
  • tools

The application uses Composer to manage external dependencies. Execute the following command in the root directory of the application to fetch them:

$ composer install

Composer

Alternatively you can also use Composer to install the source code together with all dependencies:

$ composer create-project wcmf/wcmf-default-app wcmf-default-app

Model the domain

The application ships with a demo UML model that may be used as a quick start. It's located in model/model.uml. Base models for those who want to start from scratch are located in model/base/cwm/ and model/base/papyrus/. An in-depth guide on modeling for wCMF may be found in the section Model.

Generate the code

A code generator is used to generate class- and configuration files from the domain model. Execute the following command in the build directory of the application in order to run the generator:

$ ant generate

Setup the database connection

The database connection information is defined in the file app/config/server.ini and defaults to

1 [Database]
2 dbType = mysql
3 dbHostName = 127.0.0.1
4 dbName = wcmf_testapp
5 dbUserName = root
6 dbPassword =
7 dbCharSet = utf8

Change these values to fit your local configuration. If privileges are granted, the database will be created automatically in the next step. If not, you have to create it beforehand.

Run installation scripts

Open a web browser and navigate to http://localhost/wcmf-default-app/install/. Click the buttons:

  • Update database to create the application tables
  • Initialize database to create the initial data (e.g. the admin user)

Open the application

Navigate to http://localhost/wcmf-default-app/app/public/ to open the login screen. Sign in using

  • Username: admin
  • Password: admin