This repository contains an example of a new VoIP Provider for VoIP Integration extension for EspoCRM.
- EspoCRM v7.0+
- VoIP Integration v1.17.0+
- Define a name of your extension.
php init.php
- Install necessary dependencies:
npm install
-
Create a
config.json
with your settings, more details. -
Create a database with the defined
name
,user
andpassword
in yourconfig.json
. -
Create a
config.php
with the version of your EspoCRM instance, more details.
<?php
return [
'version' => '7.5.0',
];
-
Put
VoIP Integration
extension package inextensions
directory, more details. -
Build your EspoCRM instance, more details.
node build --all
- After building, EspoCRM instance with installed extension will be available at
site
directory. You will be able to access it with credentials:
- Username: admin
- Password: 1
- Do development in
src
dir. - Run
node build --copy
. - Test changes in EspoCRM instance at
site
dir.
Create config.json
file in the root directory. You can copy config-default.json
and rename it to config.json
.
When reading, this config will be merged with config-default.json
. You can override default parameters in the created config.
Parameters:
- espocrm.repository - from what repository to fetch EspoCRM;
- espocrm.branch - what branch to fetch (
stable
is set by default); you can specify version number instead (e.g.5.9.2
); - database - credentials of the dev database;
- install.siteUrl - site url of the dev instance.
You can override EspoCRM config. Create config.php
in the root directory of the repository. This file will be applied after EspoCRM intallation (when building).
Example:
<?php
return [
'useCacheInDeveloperMode' => true,
];
After building, EspoCRM instance with installed extension will be available at site
directory. You will be able to access it with credentials:
- Username: admin
- Password: 1
- You need to have node, npm, composer installed.
- Run
npm install
. - Create a database. The database name is set in the config file.
It will download EspoCRM (from the repository specified in the config), then build and install it. Then it will install the extension.
Command:
node build --all
Note: It will remove a previously installed EspoCRM instance, but keep the database intact.
You need to run this command every time you make changes in src
directory and you want to try these changes on Espo instance.
Command:
node build --copy
AfterInstall.php will be applied for EspoCRM instance.
Command:
node build --after-install
Command:
node build --extension
The package will be created in build
directory.
Note: The version number is taken from package.json
.
If your extension requires other extensions, there is a way to install them automatically while building the instance.
Necessary steps:
- Add the current EspoCRM version to the
config.php
:
<?php
return [
'version' => '7.5.0',
];
-
Create the
extensions
directory in the root directory of your repository. -
Put needed extensions (e.g.
my-extension-1.0.0.zip
) in this directory.
Extensions will be installed automatically after running the command node build --all
or node build --install
.
The version number is stored in package.json
and package-lock.json
.
Bumping version:
npm version patch
npm version minor
npm version major
Prepare:
node build --copy
cd site
grunt test
Command to run unit tests:
vendor/bin/phpunit tests/unit/Espo/Modules/{@name}
You need to create a config file tests/integration/config.php
:
<?php
return [
'database' => [
'driver' => 'pdo_mysql',
'host' => 'localhost',
'charset' => 'utf8mb4',
'dbname' => 'TEST_DB_NAME',
'user' => 'YOUR_DB_USER',
'password' => 'YOUR_DB_PASSWORD',
],
];
The file should exist before you run node build --copy
.
Command to run integration tests:
vendor/bin/phpunit tests/integration/Espo/Modules/{@name}
You need to set the following paths to be ignored in your IDE:
build
site/build
site/application/Espo/Modules/{@name}
site/tests/unit/Espo/Modules/{@name}
site/tests/integration/Espo/Modules/{@name}
Change a license in LICENSE
file. The current license is intended for scripts of this repository. It's not supposed to be used for code of your extension.