项目作者: mostrovski

项目描述 :
MVC application (PHP/MySQL)
高级语言: PHP
项目地址: git://github.com/mostrovski/digitaliseme.git
创建时间: 2019-05-18T19:19:15Z
项目社区:https://github.com/mostrovski/digitaliseme

开源协议:

下载


Digitalise Me :: cozy document archive

A demo PHP project showcasing building the MVC application from scratch.

Minimum requirements

A client deals with lots of physical documents. The application should store
digital copies of that documents as well as the following information for
each document:

  • title;
  • date of issue;
  • name, email, and phone number of the document issuer;
  • type (category) of the document;
  • information on where the original (physical) version is stored;
  • keywords.

The application should provide the possibility to create, read, update,
delete
, and search for document records, as well as to upload and download
digital copies of the documents.

New users should be able to sign up. Registered users should be able to
access the application using their usernames and passwords.

Authenticated users should be able to upload and download files, create, read,
and search for document records. They should be authorized to update and
delete only the records they created.

Approach

The original implementation of this project dates back to 2018 - it happened to be my very first PHP project.
Since then, my skills and preferences naturally evolved, so I decided to make a rebuild, changing a lot but preserving the original spirit:

  • the project should be designed as the Model-view-controller (MVC) application;
  • the productive part of the application should have zero dependencies on any third-party libraries or frameworks;
  • for the backend architecture is the main focus, styles are irrelevant.

Here are some of the changes that come with the rebuild:

  • project structure;
  • approach to the configuration;
  • application bootstrap;
  • request cycle;
  • database abstraction;
  • routing;
  • messaging between the models and controllers;
  • view rendering.

For “then and now” kind of thing, the old code is still available in the xampp branch.

How to run it

  1. Make sure you have DDEV installed.
  2. Clone, or download and extract the repository.
  3. Change to the root of the project.
  4. Run the following commands:
    1. ddev start
    2. ddev import-db --file=_db/dump.sql
    3. ddev storage-link
  5. Head over to the https://digitaliseme.ddev.site in your browser.

Useful commands

  1. # Start containers (will also trigger the composer install)
  2. ddev start
  3. # If you make changes to the .ddev/config.yaml
  4. ddev restart
  5. # Import the database from the dump file
  6. ddev import-db --file=<filename>.sql
  7. # Open the application in the browser
  8. ddev launch
  9. # Open the database GUI in the browser
  10. ddev phpmyadmin
  11. # Symlink the storage directory to the public directory
  12. ddev storage-link
  13. # Lint the code
  14. ddev exec './vendor/bin/php-cs-fixer fix'
  15. # Stop containers
  16. ddev stop

Kudos