I am kind of new to OOP in Php (but possess a good understanding of oop in java) and want to build a simple accounting system that will keep track of the business expense and revenues (generated from selling some service) and produce a monthly balance sheet(revenue-expense).
The mysql database is quite simple with the following tables:
user - login_id(pk), name, pass etc
customer - id(pk), name, tel etc
income - bill_no(pk), cust_id, description, date, amount etc
expense - receipt_no(pk), description, date, amount
I have already made significant progress with the following files (i am just showing the basic structure)
config.php
----------
class DB_Class {
function __construct() {
//connect to db or die
}
}
functions.php
-------------
class User{
public function __construct() {
new DB_Class();
}
public function register_user(params){
}
public function check_login(params){
}
public function get_session(){
}
public function user_logout(){
}
}
registration.php
----------------
//html form
//new User() -> register_user(params)
login.php
---------
//new User() ->get_session()
//new User() ->check_login()
index.php
---------
//check session
My question is, what can be the other basic/must have/potential files, classes and their methods for such kind of system? I understand that it varies widely according to the system design, but any feedback/suggestion will be a very valuable input for me at this stage.
functions.php - strange name for a user class file, call it user.php. If you're holding several classes in a single file, separate them.
Possible extensions: you might want to make Expense and Income abstract and then specialize concrete incomes and expenses.
You might also want to have a class to model a Service which is sold.
Attention - possible clash if you want to give system access to customers - than you have overlapping between Customer and User class.
These are just some hints, hard to tell something more without more info about the domain rules, system restrictions, design, etc.