Simple installer for php project, created based on Codeigniter 3
This project require Codeigniter 3, angularjs, and bootstrap
To setup project dependencies you can run:
composer install to install php dependency, and bower install to install all javascript and css dependency.
To use simple-php-installer you need to create directory with name installer-resources in same directory with index.php, then add file named php-installer.conf.php inside directory installer-resources
<root-dir>
|--+ installer (php installer dir)
|--+ installer-resource
|--+ php-installer.conf.php
|--+ <installer-source-dir>
<root-dir>is directory that application tobe installed, it could be anything like htdoc, www, or htdoc/your-app/, etc.installerlocation of simple-php-installer code.php-installer.conf.phpsimple-php-installer configuration file<installer-source-dir>location of installer resource, like project configuration file, project source code, database (.sql file), etc.
$config['php_installer'] = array(
'appName' => 'PHP Installer', // your application name
'appVersion' => '0.0.0.0', // Your application version
'base' => array(
'srcFile' => '', // Source file <not yet implemented>
'dstDir' => './' // Destination dir <not yet implemented>
),
'actions' => array(), // The Installer Action
'configs' => array(), // Your application configuration
);array(
'type' => 'extract', // Action type
'source' => 'installer-resources/installer/sources.zip', // Source
'destination' => '../', // Destionation
'configs' => null // Action config
)'type'is installer action type. List of installer action type:copyto copy file or directorycutto move file or directorydeleteto delete file or directoryextractto extract zip filesql_queryto run sql query filerunto run command
'source'is installer action source it could be file, directory, or command (based on'type')'destination'is the destination file or directory. This option is optional based on'type'it's required when the'type'iscopy,cut,extract.'configs'is configuration for Installer Action. This option is optional, it's usually used when the'type'issql_query. Example'configs':
array(
'type' => 'sql_query',
'source' => 'installer-resources/installer/db/myDB.sql',
'configs' => '[group:database]',
)'[group:database]' in the code above mean: the configuration is taken from Installer Configuration with group named 'database'
array(
'group' => 'database',
'label' => 'Database Config',
'icon' => 'fa-database',
'source' => 'installer-resources/installer/database.php.conf',
'dest' => '../application/config/database.php',
'fields' => array()
)'group'is group name for Installer Configuration it's required and it could be anything, in this case database.'label'is display text on the menu, it's required.'icon'is icon for menu, it's font awesome class, it's optional.'source'is source configuration file, it's required.'dest'is deployed configuration file, it's required.'fields'is the fields in configuration file, it's required.
array(
'name' => 'password',
'label' => 'Password',
'type' => 'password',
'required' => true,
'default' => null,
'readonly' => false
)Installer configuration fields is required to generate field editor for simple-php-installer ui.
'name'is field name in configuraton file, it's required.'label'is the label that shown in simple-php-installer ui, it's required.'type'is field type, it's requied. Field type list:textfor text field.numberfor number field.passwordfor password field.string_listsfor string lists.boolfor boolean field.selectfor combobox field (not implemented yet).
'required'is the mark if the field is can't be empty, it's optional.'default'is default value for the field, it's optional, you can also call decalered php function by using bracket{}, example:
array(
'name' => 'base_url',
'label' => 'Base Url',
'type' => 'text',
'required' => true,
'readonly' => false,
'default' => '{base_url("../index.php")}'
)'readonly'if true then the field editor will be readonly mode, it's optional.
<?php
/**
* simple-php-installer configuration file example.
* Author: ripsware
* Date : 05/09/2015
* Time : 17:13
*/
$config['php_installer'] = array(
'appName' => 'PHP Installer',
'appVersion' => '0.0.0.0',
'base' => array(
'srcFile' => 'installer-resources/installer/app.zip',
'dstDir' => '../'
),
'actions' => array(
array(
'type' => 'extract',
'source' => 'installer-resources/installer/sources/release.zip',
'destination' => '../',
),
array(
'type' => 'extract',
'source' => 'installer-resources/installer/sources/manage-km.zip',
'destination' => '../manage/',
),
array(
'type' => 'sql_query',
'source' => 'installer-resources/installer/db/myDB.sql',
'configs' => '[group:database]',
)
),
'configs' => array(
array(
'group' => 'general',
'label' => 'General Config',
'icon' => null,
'source' => 'installer-resources/installer/app.js.conf',
'dest' => '../app/controllers/app.js',
'fields' => array(
array(
'name' => 'base_url',
'label' => 'Base Url',
'type' => 'text',
'required' => true,
'readonly' => false,
'default' => '{base_url("../index.php")}'
),
)
),
array(
'group' => 'database',
'label' => 'Database Config',
'icon' => 'fa-database',
'source' => 'installer-resources/installer/database.php.conf',
'dest' => '../manage/application/config/database.php',
'fields' => array(
array(
'name' => 'hostname',
'label' => 'Hostname',
'type' => 'text',
'required' => true
),
array(
'name' => 'username',
'label' => 'Username',
'type' => 'text',
'required' => true
),
array(
'name' => 'password',
'label' => 'Password',
'type' => 'password',
'required' => true
),
array(
'name' => 'database',
'label' => 'Database',
'type' => 'text',
'required' => true
),
array(
'name' => 'dbdriver',
'label' => 'Database Type',
'type' => 'text',
'required' => true,
'default' => 'mysqli',
'readonly' => true
),
)
),
array(
'group' => 'ldap',
'label' => 'LDAP Config',
'source' => 'installer-resources/installer/ripsware.php.conf',
'dest' => '../manage/application/config/ripsware.php',
'fields' => array(
array(
'name' => 'use_ldap',
'label' => 'Use LDAP',
'type' => 'bool',
'required' => true
),
array(
'name' => 'server',
'label' => 'LDAP Server',
'type' => 'text',
'required' => true
),
array(
'name' => 'port',
'label' => 'LDAP Port',
'type' => 'number',
'required' => false,
'default' => 389
),
array(
'name' => 'domains',
'label' => 'Domain Lists',
'type' => 'string_lists',
'required' => true,
),
array(
'name' => 'default_domain',
'label' => 'Default Domain',
'type' => 'text',
'required' => true,
),
)
),
)
);