zefix
A Drupal module that provides API integration for the Central Business Name Index (ZEFIX) of Switzerland.
Description
The Zefix module enables Drupal sites to integrate with Switzerland's official commercial register database through the ZEFIX REST API. ZEFIX is the centralized online database of the Swiss Commercial Register, containing vital legal and economic information about companies domiciled in Switzerland.
Features
- Company Search: Search for companies registered in the commercial register by various parameters
- Company Details: Retrieve detailed company information by UID, CHID, or EHRAID
- SOGC Integration: Access Swiss Official Gazette of Commerce (SOGC) publications
- Legal Forms: Query available legal forms for Swiss companies
- Registry Information: Access registry of commerce data
- Community Data: Retrieve community-based company information
- Date-based Queries: Search companies by registration or modification dates
- Environment Support: Configurable test and production environment endpoints
Requirements
- Drupal 8.8+ (compatible with Drupal 8, 9, 10, and 11)
- Valid ZEFIX API credentials (username and password)
- cURL extension for PHP
Installation
Via Composer (Recommended)
composer require drupal/zefix
Manual Installation
- Download the module and place it in your
modules/contribdirectory - Enable the module:
drush en zefix
Configuration
- Navigate to Administration > Configuration > System > Zefix API Configuration (
/admin/config/system/zefix) - Configure the following settings:
- Environment: Choose between Test or Production
- User: Your ZEFIX API username
- Password: Your ZEFIX API password
API Services
The module provides several services for interacting with the ZEFIX API:
Company Search
$search_service = \Drupal::service('zefix.search');
$results = $search_service->search($search_parameters);
Company Details by UID
$uid_service = \Drupal::service('zefix.showUID');
$company = $uid_service->showUID('CHE-123456789');
SOGC Publications
$sogc_service = \Drupal::service('zefix.get');
$publication = $sogc_service->get('publication_id');
Other Available Services
-
zefix.showCHID- Get company details by CHID -
zefix.showEhraid- Get company details by EHRAID -
zefix.community- Community-related queries -
zefix.legalForm- Legal form information -
zefix.registryOfCommerce- Registry of commerce data -
zefix.byDate- Date-based company queries -
zefix.byBfsCommunityId- BFS community-based queries
API Endpoints
The module connects to the official ZEFIX REST API:
-
Test Environment:
https://www.zefixintg.admin.ch/ZefixPublicREST/api/v1/ -
Production Environment:
https://www.zefix.admin.ch/ZefixPublicREST/api/v1/
Usage Examples
Basic Company Search
$search_service = \Drupal::service('zefix.search');
$search_data = [
'name' => 'Example Company',
'activeOnly' => true
];
$results = $search_service->search($search_data);
Get Company by UID
$uid_service = \Drupal::service('zefix.showUID');
$company_details = $uid_service->showUID('CHE-123456789');
Error Handling
All services include error handling and logging. Failed API requests are logged to the Drupal watchdog with the 'zefix' channel. Check your site's logs for debugging API connection issues.
Permissions
The module defines the following permission:
- Administer zefix configuration: Required to access the configuration form
API Documentation
For detailed information about the ZEFIX API endpoints and parameters, refer to the official API documentation:
Support
Acknowledgements
This module was initially developed by Effective Bytes and funded by GS1 Switzerland.
License
This project is licensed under the GPL-2.0-or-later license.
Contributing
Contributions are welcome! Please follow Drupal coding standards and submit patches through the project's issue queue.