A very simple address book
OpenAddressBook store the datas in Redis. Install it, before.
git clone https://github.com/leblanc-simon/OpenAddressBook.git
cd OpenAddressBook
composer install
cp web/js/config.js.dist web/js/config.js
Configure your webserver to redirect all nonexistent files to web/api.php. Example of .htaccess file :
DirectoryIndex index.html
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)$ api.php [QSA,L]
If you want use the click2call, copy config/click2call.yml.dist
to config/click2call.yml
,
configure it and activate click2call into the web/js/config.js
(set click2call_enable to true)
Click2Call is available for Ovh, if you have an other provider, create a class implements
\OpenAddressBook\Click2Call\Click2CallInterface and change the class name into the config/click2call.yml
file
You can connect OpenAddressBook to an external source. Now, a connector for Odoo already exist.
To connect OpenAddressBook and Odoo
- copy and edit
config/command.yml.dist
toconfig/command.yml
- copy and edit
config/odoo.yml.dist
toconfig/odoo.yml
- run
bin/console address:retrieve
You can add the command bin/console address:retrieve
into a cronjob to update the database periodically.
To connect OpenAddressBook and another external source
- create a connector class which implements
\OpenAddressBook\Connector\ConnectorInterface
- create a item class which implements
\OpenAddressBook\Connector\ItemInterface
- copy
config/command.yml.dist
toconfig/command.yml
- edit
config/command.yml
to indicate your class into theconnector
parameter and editoptions
parameters
You can show the \OpenAddressBook\Connector\Odoo\Connector
and \OpenAddressBook\Connector\Odoo\Item
classes for inspiration.
If you want use OpenAddressBook with multiple databases, you can use environment variable OAB_BD_NAME
:
- Set environment variable in your PHP-FPM configuration
- Or set environment variable in your Apache configuration
- if you use Click2Call, name your parameter file with the
OAB_BD_NAME
, example :- with
OAB_BD_NAME
equalsotherdb
- name the parameter file
config/click2call-otherdb.yml
- with
Get all addresses
GET http://localhost/api/v1/address-books.json
Get an address
GET http://localhost/api/v1/address-books/1.json
Insert an address
POST -X "name=my-name&phone=+33.3.20.20.20.20" http://localhost/api/v1/address-books.json
Update an address
POST -X "name=my-name&phone=+33.3.20.20.20.20" http://localhost/api/v1/address-books/1.json
Remove an address
DELETE http://localhost/api/v1/address-books/1.json