https://github.com/eghojansu/wai
Web Application Installer
https://github.com/eghojansu/wai
Last synced: 2 months ago
JSON representation
Web Application Installer
- Host: GitHub
- URL: https://github.com/eghojansu/wai
- Owner: eghojansu
- Created: 2016-05-23T08:05:41.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-08T11:29:10.000Z (almost 9 years ago)
- Last Synced: 2025-02-09T12:43:12.456Z (4 months ago)
- Language: PHP
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Wai
Web application installer
## Usage
In your entry file (eg. index.php) add statements like below to get this work.
```php
'0.1.0',
// used for saving installed version and schema, ensure this directory is writable
'workingDir' => 'tmp/',
// schema directory that contains every schema that need to be installed
// filename should be prefixed by ordered number
'schemaDir' => 'app/schema/',
// argument for constructing PDO class
'database' => [
// dsn, string, without database name
'dsn' => 'mysql:host=127.0.0.1',
// username, string
'username' => 'root',
// password, string
'password' => null,
// options, array
'options' => [],
// database name
'dbname' => 'test_wai',
// drop db first
'dropdb' => false,
],
];
Wai::setup($config);// check if current version is same as installed version
if (Wai::isNotInstalled()) {// not installed, install it
// you can pass array of callback that will be execute
// before and after database procedure called
$dir = __DIR__;
$callbacksBefore = [
function() use ($dir) {
chmod($dir.'/tmp', 0777);
},
function() {
// other statements to do
},
];
$callbacksAfter = [
function() {
// other statements to do
},
];
Wai::handleInstallation($callbacksBefore, $callbacksAfter);
}// catch result
// $result = Wai::result();// or write result and exit
Wai::hold();
```