SimpleXML a given XML file. Extract data and store
MVC, Repository, (*1)
It is designed with the Repository Pattern, which allows a Controller to pass data to the Repository which in turn interfaces with the Model., (*2)
This is achieved by injecting a repository Dependency in the Controller, so that the repository implements its interface with the model, starting in the Controller., (*3)
OOP (Interfaces, Namespaces, Encapsulation, Information Hiding, properties and methods Accessibility, Static, Dynamic, etc.)., (*4)
All this ensures the code is: - Testable (injection are mocked) - Maintainable (OOP not procedural) - Reduced code (reusable), and - Less bugs (info hiding, accessibility, encapsulation, etc), (*5)
Note: The specifics for this Development Environment follows:, (*6)
Virtual Box, Vagrant, Centos 7, PHP 5.6, MySQL 14.14, PHPMyAdmin, git, composer, artisan, pear, PHPStorm 2017 with XDebug, Code Sniffer (phpcs), GitHub);, (*7)
The blade template receives the the associative array() containing the config.XML data, (*8)
Note: This project uses the SimpleXML - PHP5’s new API for accessing the contents of XML documents., (*9)
Q: Why Laravel?, (*10)
A: Choices! Everybody is using it and it works well. I just like the brand, though some online resources ought to be free, as is most community support, (*11)
Install this package, (*12)
composer require webnanogy/dario
Run the following command inside this app's root directory, (*13)
composer install
Modify .env DB, (*14)
Ex: DB_CONNECTION='target DBMS'
DB_HOST='target IP address'
DB_PORT='target DBMS connection port'
DB_DATABASE='target DBMS db name'
DB_USERNAME='target DBMS user name'
DB_PASSWORD='target DBMS user password', (*15)
Change the .env file 'APP_URL' for the target server EX: APP_URL='target server app url', (*16)
Migrate the package/laravel tables by running:, (*17)
php artisan migrate, (*18)
Publish the config.XML and assets, (*19)
php artisan vendor:publish, (*20)
Copy the following to the apps 'routes/web.php', (*21)
Run Laravel home page and append receive EX: http.../localhost/laravel/output/public/receive, (*22)
Given the spec, the assumptions follow:, (*23)
'receive' and 'create', (*24)
The config.XML path will be defined in the .env file., (*25)
Because it is a configuration file, I assumed that the structure will not change often ('from time to time'). So the code is strongly coupled around the given config file, and will choke with a different XML file structure., (*26)
All functionality required to fulfill most of this project's requirements was implemented with the Laravel ecosystem and PHP native functions., (*27)
PSR-1/2/3/4, (*28)
Dario Alfredo, (*29)