Thank you for your contribution. OpenEMR (and global healthcare) continues to get better because of people like you!
The maintainers of OpenEMR want to get your pull request in as seamlessly as possible, so please ensure your code is consistent with our development policies.
You will need a "local" version of OpenEMR to make changes to the source code. The easiest way to do this is with Docker:
- Create your own fork of OpenEMR (you will need a GitHub account) and
git clone
it to your local machine.- If you haven't already, install git for your system
- (optional) If you want to set up the base services(e.g. git, docker, docker-compose, openemr-cmd, minkube and kubectl) easily, please try openemr-env-installer
- (optional) It's best to also add an
upstream
origin to keep your local fork up to date. Check out this guide for more info.
cd openemr/docker/development-easy
(if you are running this on Raspberry Pi, then instead docd openemr/docker/development-easy-arm32
orcd openemr/docker/development-easy-arm64
)- If you haven't already, install Docker and install compose for your system
- (optional) If you want to troubleshoot with the below steps easier, please also install openemr-cmd for your system
- (optional) If you want to monitor and easily manage the docker environment, please also install openemr-monitor and install portainer for your system
- (optional) If you want to migrate the running docker environment, please try openemr-env-migrator
- (optional) If you want to set up with orchestration tool, please try OpenEMR Kubernetes Orchestrations
- Run
docker-compose up
from your command line- When the build is done, you'll see the following message:
openemr_1 | Love OpenEMR? You can now support the project via the open collective: openemr_1 | > https://opencollective.com/openemr/donate openemr_1 | openemr_1 | Starting cron daemon! openemr_1 | Starting apache!
- Navigate to
http://localhost:8300/
orhttps://localhost:9300/
to login asadmin
. Password ispass
. - If you wish to connect to the sql database, this docker environment provides the following 2 options:
- Navigate to
http://localhost:8310/
where you can login into phpMyAdmin. - Or you can directly connect to port 8320 via your favorite sql tool (Mysql Workbench etc.).
- Use
username/user
: openemr,password
: openemr .
- Navigate to
- Make changes to any files on your local file system. Most changes will appear after a refresh of the page or iFrame you're working on.
- An exception to this is if making changes to styling scripts in interface/themes/. In that case will need to clear web browser cache and run the following command to rebuild the theme files:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools build-themes'
- An exception to this is if making changes to styling scripts in interface/themes/. In that case will need to clear web browser cache and run the following command to rebuild the theme files:
- When you're done, it's best to clean up after yourself with
docker-compose down -v
- If you don't want to build from scratch every time, just use
docker-compose down
so your nextdocker-compose up
will use the cached volumes.
- If you don't want to build from scratch every time, just use
- To ensure you are using the most recent dockers, recommend running below set of commands intermittently:
docker pull openemr/openemr:flex docker pull mariadb:10.5 docker pull phpmyadmin/phpmyadmin docker pull couchdb docker pull openemr/dev-ldap:easy
- Submit a PR from your fork into
openemr/openemr#master
!
We look forward to your contribution...
The OpenEMR development docker environment has a very rich advanced feature set. See below Index for links to all the cool advanced stuff:
Index for Advanced Use of OpenEMR Development Docker Environment
- Xdebug and profiling
- Testing other PHP versions
- Php syntax checking, psr12 checking, and automated testing
- Run the entire dev tool suite
- Run only all the automated tests
- Resetting OpenEMR and loading demo data
- Backup and restore OpenEMR data
- Send/receive snapshots
- Turn on and turn off support for multisite feature
- Change the database character set and collation
- Test ssl certificate and force/unforce https
- Place/remove testing sql ssl certificate and testing sql ssl client key/cert
- CouchDB integration
- LDAP integration
- Xdebug and profiling is supported for PHPStorm and VSCode.
- Firefox/Chrome install xdebug helper add on and enable
- PHPStorm Settings->Language & Frameworks->PHP->Debug
- Start listening
- Untoggle "Break at first line in PHP scripts"
- Untoggle both settings that start with "Force Break at first line..."
- See these images for more detail
- VSCode
- Listen for XDebug
- Use this
launch.json
template
- Make sure port 9003 is open on your host operating system
- Profiling output can be found in /tmp directory in the docker. Following will list the profiling output files:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools list-xdebug-profiles'
- To check Xdebug log:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools xdebug-log'
- Testing other PHP versions.
- The standard
flex
docker used in the easy development environments is PHP 7.4. This can be modified by changing the image (image: openemr/openemr:flex
) used in the docker-compose.yml script. To use PHP 8.0 , then just need to change it toimage: openemr/openemr:flex-3.13-8
. To use PHP 7.3 requires 2 changes; change image toimage: openemr/openemr:flex-3.12
and then add the following environment setting to the openemr service:XDEBUG_IDE_KEY: PHPSTORM
.
- The standard
- Php syntax checking, psr12 checking, and automated testing.
- To check PHP error logs:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools php-log'
- To create a report of PSR12 code styling issues (this takes several minutes):
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools psr12-report'
- To fix PSR12 code styling issues (this takes several minutes):
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools psr12-fix'
- To create a report of theme styling issues:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools lint-themes-report'
- To fix theme styling issues:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools lint-themes-fix'
- To check PHP parsing errors (this takes several minutes):
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools php-parserror'
- To run unit testing:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools unit-test'
- To run api testing:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools api-test'
- To run e2e testing:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools e2e-test'
- To run services testing:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools services-test'
- To run fixtures testing:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools fixtures-test'
- To run validators testing:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools validators-test'
- To run controllers testing:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools controllers-test'
- To run common testing:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools common-test'
- To check PHP error logs:
- Run the entire dev tool suite (PSR12 fix, lint themes fix, PHP parse error, unit/API/e2e/services/fixtures/validators/controllers/common tests) in one command, run
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools clean-sweep'
- Run only all the automated tests (unit/API/e2e/services/fixtures/validators/controllers/common tests) in one command, run
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools clean-sweep-tests'
- Resetting OpenEMR and loading demo data.
- To reset OpenEMR only (then can reinstall manually via setup.php in web browser):
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools dev-reset'
- When running setup.php, need to use
mysql
for 'Server Host',root
for 'Root Password', and%
for 'User Hostname'.
- When running setup.php, need to use
- To reset and reinstall OpenEMR:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools dev-reset-install'
- To reset and reinstall OpenEMR with demo data (this includes several users with access controls setup in addition to patient portal logins. See HERE for those credentials.):
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools dev-reset-install-demodata'
- hint: this is also a great way to test any changes a developer has made to the sql upgrade stuff (ie. such as sql/5_0_2-to-6_0_0_upgrade.sql)
- To reset OpenEMR only (then can reinstall manually via setup.php in web browser):
- Backup and restore OpenEMR data (database and data on drive) via snapshots.
- Create a backup snapshot (using
example
below, but can use any alphanumeric identifier):docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools backup example'
- Restore from a snapshot (using
example
below, but can use any alphanumeric identifier)docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools restore example'
- To list the snapshots
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools list-snapshots'
- Create a backup snapshot (using
- Send/receive snapshots (via capsules) that are created above in item 11.
- Here is how to grab a capsule from the docker, which can then store or share with friends.
- List the capsules:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools list-capsules'
- Copy the capsule from the docker to your current directory (using
example.tgz
below):docker cp $(docker ps | grep _openemr | cut -f 1 -d " "):/snapshots/example.tgz .
- List the capsules:
- Here is how to send a capsule into the docker.
- Copy the capsule from current directory into the docker (using
example.tgz
below):docker cp example.tgz $(docker ps | grep _openemr | cut -f 1 -d " "):/snapshots/
- Restore from the new shiny snapshot (using
example
below):docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools restore example'
- Ensure run upgrade to ensure will work with current version OpenEMR:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools upgrade 5.0.2'
- Copy the capsule from current directory into the docker (using
- Here is how to grab a capsule from the docker, which can then store or share with friends.
- Turn on and turn off support for multisite feature.
- Turn on support for multisite:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools enable-multisite'
- Turn off support for multisite:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools disable-multisite'
- Turn on support for multisite:
- Change the database character set and collation (character set is the encoding that is used to store data in the database; collation are a set of rules that the database uses to sort the stored data).
- Best to demonstrate this devtool with examples.
- Set character set to utf8mb4 and collation to utf8mb4_general_ci (this is default for OpenEMR 6 and higher):
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools change-encoding-collation utf8mb4 utf8mb4_general_ci'
- Set character set to utf8mb4 and collation to utf8mb4_unicode_ci:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools change-encoding-collation utf8mb4 utf8mb4_unicode_ci'
- Set character set to utf8mb4 and collation to utf8mb4_vietnamese_ci:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools change-encoding-collation utf8mb4 utf8mb4_vietnamese_ci'
- Set character set to utf8 and collation to utf8_general_ci (this is default for OpenEMR 5 and lower):
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools change-encoding-collation utf8 utf8_general_ci'
- Set character set to utf8mb4 and collation to utf8mb4_general_ci (this is default for OpenEMR 6 and higher):
- Best to demonstrate this devtool with examples.
- Test ssl certificate (to test client based certificates and revert back to default self signed certificate) and force/unforce https.
- To test client based certificates, create a zip package of the certificate in OpenEMR at Administration->System->Certificates. Then can import this zip package (example
ssl.zip
) into the docker via:docker cp ssl.zip $(docker ps | grep _openemr | cut -f 1 -d " "):/certs/
- To list the available certificate packages on docker:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools list-client-certs'
- To install and configure a certificate package (example
ssl
):docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools setup-client-cert ssl'
- To revert back to selfsigned certicates (ie. revert the changes required for client based certificates):
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools on-self-signed-cert'
- To force https in apache script via redirect:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools force-https'
- To revert the changes that forced https in apache script:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools un-force-https'
- To test client based certificates, create a zip package of the certificate in OpenEMR at Administration->System->Certificates. Then can import this zip package (example
- Place/remove testing sql ssl certificate and testing sql ssl client key/cert.
- Place the testing sql ssl CA cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools sql-ssl'
- Remove the testing sql ssl CA cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools sql-ssl-off'
- Place the testing sql ssl CA cert and testing sql ssl client key/cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools sql-ssl-client'
- Remove the testing sql ssl CA cert and testing sql ssl client key/cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools sql-ssl-client-off'
- Place the testing sql ssl CA cert:
- CouchDB integration.
- In OpenEMR, CouchDB is an option for the patients document storage. For this reason, a CouchDB docker is included in this OpenEMR docker development environment. You can visit the CouchDB GUI directly via http://localhost:5984/_utils/ or https://localhost:6984/_utils/ with username
admin
and passwordpassword
. You can configure OpenEMR to use this CouchDB docker for patient document storage in OpenEMR at Administration->Globals->Documents:- Document Storage Method->CouchDB
- After running the following devtools, 'dev-reset', 'dev-install', 'dev-reset-install', 'dev-reset-install-demodata', 'restore-snapshot', then need to restart the couchdb docker via the following command:
docker restart $(docker ps | grep _couchdb_1 | cut -f 1 -d " ")
- Developer tools to place/remove testing couchdb ssl certificate and testing couchdb ssl client key/cert.
- Place the testing couchdb ssl CA cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools couchdb-ssl'
- Remove the testing couchdb ssl CA cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools couchdb-ssl-off'
- Place the testing couchdb ssl CA cert and testing couchdb ssl client key/cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools couchdb-ssl-client'
- Remove the testing couchdb ssl CA cert and testing couchdb ssl client key/cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools couchdb-ssl-client-off'
- Place the testing couchdb ssl CA cert:
- In OpenEMR, CouchDB is an option for the patients document storage. For this reason, a CouchDB docker is included in this OpenEMR docker development environment. You can visit the CouchDB GUI directly via http://localhost:5984/_utils/ or https://localhost:6984/_utils/ with username
- LDAP integration.
- In OpenEMR, LDAP is an option for authentication. If this is turned on, then this will be supported for the
admin
user, which will use the following password:admin
- Turn on LDAP:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools enable-ldap'
- Turn off LDAP:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools disable-ldap'
- Developer tools to place/remove testing ldap tls/ssl certificate and testing ldap tls/ssl client key/cert.
- Place the testing ldap tls/ssl CA cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools ldap-ssl'
- Remove the testing ldap tls/ssl CA cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools ldap-ssl-off'
- Place the testing ldap tls/ssl CA cert and testing ldap tls/ssl client key/cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools ldap-ssl-client'
- Remove the testing ldap tls/ssl CA cert and testing ldap tls/ssl client key/cert:
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") sh -c '/root/devtools ldap-ssl-client-off'
- Place the testing ldap tls/ssl CA cert:
- In OpenEMR, LDAP is an option for authentication. If this is turned on, then this will be supported for the
If you do not want to use Docker, you can always install OpenEMR directly on your local environment. This will require installing additional dependencies for your operating system. For more info see OpenEMR Development Versions on the wiki.
We also welcome financial contributions in full transparency on our open collective. Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
Thank you to all the people who have already contributed to openemr!
Thank you to all our backers! [Become a backer]
Thank you to all our sponsors! (please ask your company to also support this open source project by becoming a sponsor)