Difference between revisions of "Composer and NPM"

From OpenEMR Project Wiki
 
(123 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Overview=
=Overview=
==Introduction==
==Introduction==
Composer is a command line tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
:'''Composer''' provides the following key functions for OpenEMR:
:# A tool for dependency management of packages for OpenEMR in 'vendor' directory.
:# An autoloader of libraries including OpenEMR classes.


==End Goal==
:'''NPM''' provide the following key functions for OpenEMR:
:#Centralize and organize all PHP libraries/dependancies into a single directory.
:# A tool for dependency management of packages for OpenEMR in 'public/assets' directory.
:#*Use Composer to collect and organize the PHP libraries/dependancies.
:# A tool for building css theme files for OpenEMR in 'public/themes' directory.
:#*Migrate all the PHP libraries/dependancies.
:# A open door to do lots of cool stuff in the future.
:#Setup composer to use PSR-4 autoloading.
 
==More Details==
:*Composer creates a vendor directory in the root folder. This is where all the external dependencies are kept.
:*Commit the vendor directory to the codebase initially until we get composer to work with demo and build scripts.
::*The workaround is to add a .gitig nore line that removes all .git directories within your vendor directory. So add this line to the .gitignore file at the                  same level as composer.json and vendor/: <code>vendor/.git</code>
:*Get the demo and build scripts to bring in composer dependencies and package them up and test.
:*Make sure documentation on how to use composer is upto date and developers are aware of upcoming changes
:*Once this is done we can remove vendor directory from the codebase


=Installation=
=Installation=
==Windows==  
==Composer==
===Windows===
This is the easiest way to get Composer set up on your machine.
This is the easiest way to get Composer set up on your machine.


Line 52: Line 46:
   -v|vv|vvv, --verbose          Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</pre>
   -v|vv|vvv, --verbose          Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</pre>


==Linux & MacOS==  
===Linux & MacOS===  
The first step is to download Composer, which will effectively create a Phar (PHP Archive) file called composer.phar. From your terminal, run the following command:
The first step is to download Composer, which will effectively create a Phar (PHP Archive) file called composer.phar. From your terminal, run the following command:
<pre>curl -sS https://getcomposer.org/installer | php</pre>
<pre>curl -sS https://getcomposer.org/installer | php</pre>
Line 91: Line 85:
   -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
   -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
   -v|vv|vvv, --verbose          Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</pre>
   -v|vv|vvv, --verbose          Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</pre>
==NPM==
:Instructions are under construction.


=Usage=
=Usage=
Line 98: Line 95:
<pre>cd openemr
<pre>cd openemr
git checkout master</pre>
git checkout master</pre>
In order to work with Composer a project must have a composer.json file within its root directory. If you take a look at the file you’ll see a list of OpenEMR package dependencies.
:#require: a list of packages (and versions) required by OpenEMR. OpenEMR will not install if  any of those package dependencies are not met.
:#require-dev: a list of packages required by OpenEMR for development.


To run Composer for the first time and install your packages simply run:
To run Composer for the first time and install the packages simply run:
<pre>composer install</pre>
<pre>composer install</pre>


When Composer has finished its install you’ll be ready to install OpenEMR.
When Composer has finished its install you’ll be ready to install OpenEMR after you run the following commands to bring in npm packages and build css scripts and optimize composer autoloading:
<pre>npm install
npm run build
composer dump-autoload -o</pre>


Be aware that development requirements are always installed by default, Composer doesn’t magically know when it is being run on your production server. If you want to exclude development requirements you will need to run:
=Dependencies=
<pre>composer install --no-dev</pre>
==Composer==
===Always included===
#adldap2/adldap2 (REMOVED in OpenEMR 5.0.3+)
#adodb/adodb-php
#doctrine/common
#doctrine/couchdb
#doctrine/orm
#dompdf/dompdf
#ezyang/htmlpurifier (Sherwin plans to use to html escape editors that need to allow html code)
#knplabs/knp-snappy
#mobiledetect/mobiledetectlib (Ray is using this for an ongoing project that should get into codebase into the future)
#mpdf/mpdf
#phpmailer/phpmailer
#phpoffice/phpspreadsheet (Sherwin plans to use this; note Kim was planning to use a prior deprecated package phpoffice/phpexcel for allscripts rx module and will instead need to use phpspreadsheet now)
#phpseclib/phpseclib
#rospdf/pdf-php
#smarty/smarty
#stripe/stripe-php (Sherwin requested this for incorporating payment collection via stripe)
#symfony/config
#symfony/dependency-injection
#symfony/event-dispatcher
#symfony/http-foundation
#symfony/yaml
#twig/twig
#vlucas/phpdotenv
#zendframework/zendframework


=Dependencies to migrate=
===Optional===
#ADODB - adodb/adodb-php (COMPLETED)
#openemr/wkhtmltopdf-openemr - Used by institutional billing (ub04) to create the pdf's. Very large (240MB) so unable to include in main codebase. Install via following command in the openemr directory:
#html2pdf - spipu/html2pdf (also need to include setasign/fpdi-tcpdf)
#*composer require openemr/wkhtmltopdf-openemr
#TCPDF - tecnickcom/tcpdf
 
===Global===
:This section is for developers, and these are packages that should be installed globally:
#phing/phing (this is used by mechanism for cleaning out stuff when bring in new composer/npm packages)
===Work in Progress===
#html2pdf - spipu/html2pdf (also need to include setasign/fpdi-tcpdf) (PENDING REMOVAL - migrating to mPDF)
#TCPDF - tecnickcom/tcpdf (PENDING REMOVAL - migrating to mPDF)
#FPDF  - setasign/fpdf (UNABLE to do this since there is a needed minor modification to work with PDF_Label; there is no way around this since certain variables are set as protected and the prior version of FPDF that would work is not compatible with PHP7)(only plan to use FPDF for PDF_Label anyways, so not a huge deal)(is stored at library/classes/fpdf)
#FPDF  - setasign/fpdf (UNABLE to do this since there is a needed minor modification to work with PDF_Label; there is no way around this since certain variables are set as protected and the prior version of FPDF that would work is not compatible with PHP7)(only plan to use FPDF for PDF_Label anyways, so not a huge deal)(is stored at library/classes/fpdf)
#FPDI  - setasign/fpdi
#FPDI  - setasign/fpdi (COMPLETED; this was brought in by mPDF; will try to remove other copy when get rid of html2pdf/TCPDF stuff)
#Smarty - smarty/smarty (COMPLETED)
#adLDAP -  adldap/adldap (REMOVED - no longer used)
#JSON (Old JSON Wrapper, maybe replace with hampel/json?) (REMOVED- Using built in php function)
#pdf-php - rospdf/pdf-php (COMPLETED)
#phpseclib - phpseclib/phpseclib (COMPLETED)
#PhpMyAdmin - phpmyadmin/phpmyadmin (Should we even include this? The only people using this are developers? )
#phpgacl - (should move this to its own repo)
#phpmailer - phpmailer/phpmailer (COMPLETED)
#Zend - zendframework/zendframework "2.4.9",  (COMPLETED)
#Phenx - phenx/php-font-lib "0.4", (dompdf dependency) (COMPLETED)
#Phenx - phenx/php-svg-lib "0.1", (dompdf dependency) (COMPLETED)
#DomPDF - dompdf/dompdf "0.7.0", (COMPLETED)
#Doctrine - doctrine/common "2.5.0", (Doctrine CouchDB Dependency) (COMPLETED)
#Doctrine - doctrine/couchdb "1.0.*@dev" (COMPLETED) **NOTE** double check .git folder is not included after running build.xml or PHING
#Doctrine - doctrine/orm "2.5.5", (COMPLETED; NOTE THIS IS NOT YET USED IN CODEBASE, AND WILL BE USED BY DOCTRINE CODE WHICH IS UNDER DEVELOPMENT)


=Migrating=
==NPM==
===Always included===
#AnythingSlider-1-9-4
#angular-1-5-8
#angular-sanitize-1-5-8
#angular-summernote-0-8-1
#backbone-1-3-3
#bootstrap-3-3-4
#bootstrap-rtl-3-3-4
#Chart.js-2-1-3
#checklist-model-0-10-0
#ckeditor-4-11-1
#datatables.net-1-10-13
#datatables.net-bs-1-10-13
#*This is the bootstrap styling for datatables-1-10-13.
#datatables.net-dt-1-10-13
#*This is the generic styling for datatables-1-10-13.
#datatables.net-jqui-1-10-13
#*This is the jquery-ui styling for datatables-1-10-13.
#datatables.net-colreorder-1-3-2
#*This is an extension for datatables-1-10-13.
#datatables.net-colreorder-dt-1-3-2
#*This is the generic styling for datatables.net-colreorder-dt-1-3-2.
#datatables.net-scroller-1-4-2
#*This is an extension for datatables-1-10-13.
#datatables.net-scroller-jqui-1-4-2
#*This is the jquery-ui styling for datatables.net-scroller-1-4-2.
#dropzone-4-3-0
#dwv-0-21-0
#emodal-1-2-67
#flot-0-8-3
#font-awesome-4-6-3
#i18next-9-0-1
#i18next-browser-languagedetector-2-0-0
#i18next-xhr-backend-1-4-3
#jquery-creditcardvalidator-1-1-0
#jquery-datetimepicker-2-5-4
#*Use the files in build directory (and do NOT use build/jquery.datetimepicker.min.js)
#jquery.gritter-1-7-4
#jquery-min-*
#*Contain the jquery library files. This is brought in via bower by direct html download since the old versions are not available in repo (need to be built) and only 1 file is needed for these numerous different versions of jquery.
#*jquery-min-1-10-2 is used by datatables.net-1-10-13
#jquery-panelslider-0-1-1
#jquery-ui-1-10-4
#jquery-ui-1-11-4
#jquery-ui-1-12-1
#jquery-validation-1-13-0
#jscolor-2-0-4
#jszip-3-1-5
#knockout-3-4-0
#konva-1-6-8
#literallycanvas-0-4-13
#magic-wand-js
#modernizr-3-5-0
#:After collect via bower, need to do the following to create the dist/modernizr-build.js script:
#:*cd public/assets/modernizr-3-5-0
#:*npm install
#:*grunt build
#:*rm -fr node_modules
#moment-2-13-0
#numeral-1-5-3 (requested by Matrix, but not used yet)
#pure-0-5-0
#qtip2-2-2-1
#qtip2-3-0-3
#react-15-1-0
#select2
#select2-bootstrap-theme
#shortcut.js-2-01-B
#*Not supported by bower, so brought in manually to the ''manual-added-packages'' sub-directory.
#*In future, can likely bring this in via bower via http method.
#summernote-0-8-2
#*Note this has a plugin system that is not supported by bower and need to manually copy in the plugins into the asset. Here are the plugin(s) that were placed manually:
#:*The Nugget plugin was placed at summernote-0-8-2/dist/plugin/nugget/*
#underscore-1-8-3
#undone.js-0-0-1
#validate.js-0-12-0 (requested by Matrix and Ray, but not used yet)
 
=Adding new packages=
==Composer==
:# Add package/vendor to the composer.json file
:# Add package/vendor to the composer.json file
:# run <code>composer install</code>
:# run <code>composer install</code>
:##(if this isn't bringing in requested package, then will need to remove the composer.lock file before running the command)
:##(if this isn't bringing in requested package, then will need to remove the composer.lock file before running the command)
:# Remove unused files(if they are present) from the installed package (eg. git, .gitignore, tests, docs) - You must update build.xml to include directory(s).
:# Remove unused files(if they are present) from the installed package (eg. git, .gitignore, tests, docs) - You must update build.xml to include directory(s). This step will require a composer global install of phing and then use the path to phing below in the call.
:## Windows - From the command line run <code>call vendor/bin/phing vendor-clean</code>
:## Windows - From the command line run <code>call vendor/bin/phing vendor-clean</code>
:## Linux - From the command line run <code>./vendor/bin/phing vendor-clean</code>
:## Linux - From the command line run <code>./vendor/bin/phing vendor-clean</code>
:# delete the following:
:##*(btw, if need to clean up public/assets for [[Bower|bower stuff]], then run <code>./vendor/bin/phing assets-clean</code> )
:## vendor/phing directory
:## vendor/bin/phing
:## vendor/bin/phing.bat (if it exists)
:# run <code>composer dump-autoload -o</code>
:# run <code>composer dump-autoload -o</code>
==NPM==
:Instructions are under construction
=Autoloader=
==Ongoing Work==
:Working on using the autoloader to modernize the OpenEMR codebase. Steps:
:#Place the central libraries that are always called in OpenEMR into the autoloader. (COMPLETED)
:#Place the OpenEMR classes into the classmap autoloader.(IN PROGRESS)
:#*Done with library/classes with following exceptions that plan to work on:
:#:*Prescription.class.php, /ClinicalTypes, /rulesets, and /smtp.
:#Convert libraries into classes and also bring these in via the classmap autoloader.
:#Above steps will allow then to do the following:
:#*Remove globals from within classes.
:#*Write phpunit tests.
:#Place new "modernized" OpenEMR classes into the PSR-4 autoloader.(IN PROGRESS)


=Update Autoloader=
==Update Autoloader==
:If updating classes within OpenEMR to work with the autoloader, then just need to run the following command:
:If updating classes within OpenEMR to work with the autoloader, then just need to run the following command:
:* run <code>composer dump-autoload -o</code>
:* run <code>composer dump-autoload -o</code>


=Forum=
=Forum=
:*[https://sourceforge.net/p/openemr/discussion/202506/thread/0d878640/ Composer]
:*[https://community.open-emr.org/t/composer/8001 Composer]

Latest revision as of 00:58, 2 November 2019

Overview

Introduction

Composer provides the following key functions for OpenEMR:
  1. A tool for dependency management of packages for OpenEMR in 'vendor' directory.
  2. An autoloader of libraries including OpenEMR classes.
NPM provide the following key functions for OpenEMR:
  1. A tool for dependency management of packages for OpenEMR in 'public/assets' directory.
  2. A tool for building css theme files for OpenEMR in 'public/themes' directory.
  3. A open door to do lots of cool stuff in the future.

Installation

Composer

Windows

This is the easiest way to get Composer set up on your machine.

The installer will download composer for you and set up your PATH environment variable so you can simply call composer from any directory. Download and run Composer-Setup.exe - it will install the latest composer version whenever it is executed. See: https://getcomposer.org/doc/00-intro.md/

To test your installation, open up your favourite Command Line Interface (CLI) and run:

composer

And you should get output similar to this:

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.1.2 2016-05-31 19:48:11

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Linux & MacOS

The first step is to download Composer, which will effectively create a Phar (PHP Archive) file called composer.phar. From your terminal, run the following command:

curl -sS https://getcomposer.org/installer | php

The resulting file will be called composer.phar, a PHP Archive that can be executed directly via PHP. However, in our case, we want Composer to be accessible globally by simply typing composer. To do this, move it to /usr/bin/ and create an alias:

sudo mv composer.phar /usr/local/bin/
vim ~/.bash_profile

Add this to your .bash_profile. It may be empty or non-existent, so go ahead and create it:

alias composer="php /usr/local/bin/composer.phar"

Now, relaunch your terminal and you'll be able to access Composer simply by calling composer
See: https://www.abeautifulsite.net/installing-composer-on-os-x

To test your installation, open up your favourite Command Line Interface (CLI) and run:

composer

And you should get output similar to this:

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.1.2 2016-05-31 19:48:11

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

NPM

Instructions are under construction.

Usage

  1. clone the OpenEMR development version from github: https://github.com/openemr/openemr.git
git clone https://github.com/openemr/openemr.git
  1. Once it’s done run the following command to move into the OpemEMR root directory and checkout the master branch.
cd openemr
git checkout master

To run Composer for the first time and install the packages simply run:

composer install

When Composer has finished its install you’ll be ready to install OpenEMR after you run the following commands to bring in npm packages and build css scripts and optimize composer autoloading:

npm install
npm run build
composer dump-autoload -o

Dependencies

Composer

Always included

  1. adldap2/adldap2 (REMOVED in OpenEMR 5.0.3+)
  2. adodb/adodb-php
  3. doctrine/common
  4. doctrine/couchdb
  5. doctrine/orm
  6. dompdf/dompdf
  7. ezyang/htmlpurifier (Sherwin plans to use to html escape editors that need to allow html code)
  8. knplabs/knp-snappy
  9. mobiledetect/mobiledetectlib (Ray is using this for an ongoing project that should get into codebase into the future)
  10. mpdf/mpdf
  11. phpmailer/phpmailer
  12. phpoffice/phpspreadsheet (Sherwin plans to use this; note Kim was planning to use a prior deprecated package phpoffice/phpexcel for allscripts rx module and will instead need to use phpspreadsheet now)
  13. phpseclib/phpseclib
  14. rospdf/pdf-php
  15. smarty/smarty
  16. stripe/stripe-php (Sherwin requested this for incorporating payment collection via stripe)
  17. symfony/config
  18. symfony/dependency-injection
  19. symfony/event-dispatcher
  20. symfony/http-foundation
  21. symfony/yaml
  22. twig/twig
  23. vlucas/phpdotenv
  24. zendframework/zendframework

Optional

  1. openemr/wkhtmltopdf-openemr - Used by institutional billing (ub04) to create the pdf's. Very large (240MB) so unable to include in main codebase. Install via following command in the openemr directory:
    • composer require openemr/wkhtmltopdf-openemr

Global

This section is for developers, and these are packages that should be installed globally:
  1. phing/phing (this is used by mechanism for cleaning out stuff when bring in new composer/npm packages)

Work in Progress

  1. html2pdf - spipu/html2pdf (also need to include setasign/fpdi-tcpdf) (PENDING REMOVAL - migrating to mPDF)
  2. TCPDF - tecnickcom/tcpdf (PENDING REMOVAL - migrating to mPDF)
  3. FPDF - setasign/fpdf (UNABLE to do this since there is a needed minor modification to work with PDF_Label; there is no way around this since certain variables are set as protected and the prior version of FPDF that would work is not compatible with PHP7)(only plan to use FPDF for PDF_Label anyways, so not a huge deal)(is stored at library/classes/fpdf)
  4. FPDI - setasign/fpdi (COMPLETED; this was brought in by mPDF; will try to remove other copy when get rid of html2pdf/TCPDF stuff)

NPM

Always included

  1. AnythingSlider-1-9-4
  2. angular-1-5-8
  3. angular-sanitize-1-5-8
  4. angular-summernote-0-8-1
  5. backbone-1-3-3
  6. bootstrap-3-3-4
  7. bootstrap-rtl-3-3-4
  8. Chart.js-2-1-3
  9. checklist-model-0-10-0
  10. ckeditor-4-11-1
  11. datatables.net-1-10-13
  12. datatables.net-bs-1-10-13
    • This is the bootstrap styling for datatables-1-10-13.
  13. datatables.net-dt-1-10-13
    • This is the generic styling for datatables-1-10-13.
  14. datatables.net-jqui-1-10-13
    • This is the jquery-ui styling for datatables-1-10-13.
  15. datatables.net-colreorder-1-3-2
    • This is an extension for datatables-1-10-13.
  16. datatables.net-colreorder-dt-1-3-2
    • This is the generic styling for datatables.net-colreorder-dt-1-3-2.
  17. datatables.net-scroller-1-4-2
    • This is an extension for datatables-1-10-13.
  18. datatables.net-scroller-jqui-1-4-2
    • This is the jquery-ui styling for datatables.net-scroller-1-4-2.
  19. dropzone-4-3-0
  20. dwv-0-21-0
  21. emodal-1-2-67
  22. flot-0-8-3
  23. font-awesome-4-6-3
  24. i18next-9-0-1
  25. i18next-browser-languagedetector-2-0-0
  26. i18next-xhr-backend-1-4-3
  27. jquery-creditcardvalidator-1-1-0
  28. jquery-datetimepicker-2-5-4
    • Use the files in build directory (and do NOT use build/jquery.datetimepicker.min.js)
  29. jquery.gritter-1-7-4
  30. jquery-min-*
    • Contain the jquery library files. This is brought in via bower by direct html download since the old versions are not available in repo (need to be built) and only 1 file is needed for these numerous different versions of jquery.
    • jquery-min-1-10-2 is used by datatables.net-1-10-13
  31. jquery-panelslider-0-1-1
  32. jquery-ui-1-10-4
  33. jquery-ui-1-11-4
  34. jquery-ui-1-12-1
  35. jquery-validation-1-13-0
  36. jscolor-2-0-4
  37. jszip-3-1-5
  38. knockout-3-4-0
  39. konva-1-6-8
  40. literallycanvas-0-4-13
  41. magic-wand-js
  42. modernizr-3-5-0
    After collect via bower, need to do the following to create the dist/modernizr-build.js script:
    • cd public/assets/modernizr-3-5-0
    • npm install
    • grunt build
    • rm -fr node_modules
  43. moment-2-13-0
  44. numeral-1-5-3 (requested by Matrix, but not used yet)
  45. pure-0-5-0
  46. qtip2-2-2-1
  47. qtip2-3-0-3
  48. react-15-1-0
  49. select2
  50. select2-bootstrap-theme
  51. shortcut.js-2-01-B
    • Not supported by bower, so brought in manually to the manual-added-packages sub-directory.
    • In future, can likely bring this in via bower via http method.
  52. summernote-0-8-2
    • Note this has a plugin system that is not supported by bower and need to manually copy in the plugins into the asset. Here are the plugin(s) that were placed manually:
    • The Nugget plugin was placed at summernote-0-8-2/dist/plugin/nugget/*
  53. underscore-1-8-3
  54. undone.js-0-0-1
  55. validate.js-0-12-0 (requested by Matrix and Ray, but not used yet)

Adding new packages

Composer

  1. Add package/vendor to the composer.json file
  2. run composer install
    1. (if this isn't bringing in requested package, then will need to remove the composer.lock file before running the command)
  3. Remove unused files(if they are present) from the installed package (eg. git, .gitignore, tests, docs) - You must update build.xml to include directory(s). This step will require a composer global install of phing and then use the path to phing below in the call.
    1. Windows - From the command line run call vendor/bin/phing vendor-clean
    2. Linux - From the command line run ./vendor/bin/phing vendor-clean
      • (btw, if need to clean up public/assets for bower stuff, then run ./vendor/bin/phing assets-clean )
  4. run composer dump-autoload -o

NPM

Instructions are under construction

Autoloader

Ongoing Work

Working on using the autoloader to modernize the OpenEMR codebase. Steps:
  1. Place the central libraries that are always called in OpenEMR into the autoloader. (COMPLETED)
  2. Place the OpenEMR classes into the classmap autoloader.(IN PROGRESS)
    • Done with library/classes with following exceptions that plan to work on:
    • Prescription.class.php, /ClinicalTypes, /rulesets, and /smtp.
  3. Convert libraries into classes and also bring these in via the classmap autoloader.
  4. Above steps will allow then to do the following:
    • Remove globals from within classes.
    • Write phpunit tests.
  5. Place new "modernized" OpenEMR classes into the PSR-4 autoloader.(IN PROGRESS)

Update Autoloader

If updating classes within OpenEMR to work with the autoloader, then just need to run the following command:
  • run composer dump-autoload -o

Forum