Since this is a demo version of the project, here are some helpful accounts you can use to test features that are only available to high hierarchy users (like administrators, moderators, etc):
Email: [email protected]
Password: admin
Email: [email protected]
Password: mod
You can login with one of these accounts here: https://humbleprice.000webhostapp.com/login.
💡 To install the required dependencies, you'll need to have Composer installed in your machine.
To install the project dependencies, enter the src/
folder of your project using the Terminal/CMD and type the following command:
composer install
It's important to notice that it's necessary that you have some server capable of executing php
scripts and running a MySQL or MariaDB database. You can use XAMPP
, WAMP
, LAMP
, MAMP
or any other server of your choice.
All the database tables and required data are located in the file humbleprice.sql
. You can either copy the whole content of the file and paste it in your favorite database administration tool (phpMyAdmin
, Sequel Pro
, MySQL Workbench
, etc) or execute the queries
using the command-line.
In case you are importing the humbleprice.sql
file directly in phpMyAdmin
or in another database administration tool, make sure to create a database named Humbleprice
first.
In order to config your environment to run the application, you have to change the global config variables located at config/config.php
.
You can also switch environments between development
and production
at config/environment.php
The DIRPAGE
variable should contain the URL of your website. You should replace humbleprice
with your actual folder name.
You can customize the path to public assets. Here's a list of them:
DIRIMG
: Image assets (.webp
,.jpg
,.png
, etc)DIRCSS
: CSS and other stylesheetsDIRJS
: JavaScript and jQuery related filesDIRVID
: Video assets (.mp4
,.wmv
, etc)DIRAUD
: Audio assets (.mp3
,.ogg
, etc)DIRFONT
: Fonts used in your projectDIRDESIGN
: Design files
Configure dbname
, host
, dbuser
and dbpass
to fit your project and database needs.
The default dbuser
and dbpass
are root
and an empty password (respectively), but it may change based on your installation and in what you are using (XAMPP
, WAMP
, LAMP
, MAMP
, etc).
This project makes use of the MVC architecture. It's recommended to get familiar with this concept before proceeding to use or modify this project.
The app
directory contains the core code of your application. There you can find the project Dispatcher
, Controllers
, Models
and Views
, which are the base structure of a MVC project.
-
Controllers
: Controllers can group related request handling logic into a single class. For example, aUserController
class might handle all incoming requests related to users, including showing, creating, updating, and deleting users. -
Core
: These are the core classes of the application. It includes a baseController
(which every Controller must extend), anAuthorization
class that may or may not be extended by a Controller, aRender
class responsible for rendering views and aTable
class responsible for defining the base structure of aModel
. -
Models
: The model component stores data and its related logic. It represents data that is being transferred between controller components or any other related business logic. For example, a Controller object will retrieve the customer information from the database. It manipulates data and send back to the database or use it to render the same data. All models must call theparent::__construct()
and have a table associated with it by overwriting the$table
property. -
Views
: A View is the part of the application that represents the presentation of data. A view may have a main content (represented bymain.php
), additional footer information for a specific page (repesented byfooter.php
) and/or additional head information (represented byhead.php
). All the information of how it's done can be found in theapp/Core/Render.php
file. Every View needs to be a folder with just one or even all these three files. TheLayout
used by all the views is located atapp/Views/Layout.php
. -
Dispatch
: The Dispatch file is responsible for bootstraping the application. -
Helpers
: These are some helpful (duh) functions used throughout the entire project. This file is autoloaded using Composer.
These are the project configuration files. You can find instructions on how to use then here.
Here are located all the public assets of your project.
This is where your Classes, Traits, Interfaces and Partials must be. This is also the place where your Composer
dependencies will be located (after you run composer install
, a vendor
folder will be created).
The routes are based on the Controller name and method. If you have a controller named OfferController
, for example, and you want to edit an offer, the route would be https://website.com.br/offer/edit/child-of-light
(with "child-of-light" being a parameter). If you want to use it as an example to learn more, these controller and method actually exists and can be found at app/Controllers/OfferController.php@edit
. The default controller method/action is index
.
All the routing logic is located at the app/Dispatch.php
file.
Feel free to use, test and collaborate. The more contributors, the better.