Building an ERP platform?

IMHO, 'nailing php' will take time. More time than you should be spending on it if you want to go BA. Except of course if php is part of your job. Quite honestly, most websites done with php have so many bad practices it is not true. No separation of concerns. DB access directly from the pages, etc. Not good architecture. Not worth learning or adopting. php does not lend itself to great architectural design. I will probably be flamed for the last statement, but that is my opinion.

Its not the languages fault though most of these scripting languages have that issue Javascript is also a bad one. Whenever I hear people brag about how many lines of code their *insert file type here* file has I cringe.
 
Its not the languages fault though most of these scripting languages have that issue Javascript is also a bad one. Whenever I hear people brag about how many lines of code their *insert file type here* file has I cringe.

Correct, but a scripting language promotes bad practices because it cannot help it while proper OO-languages give you the opportunity to create a great architecture. MVC a case in point. Separation of M/V/C which is very important. But we are 'jacking the thread.
 
IMHO, 'nailing php' will take time. More time than you should be spending on it if you want to go BA. Except of course if php is part of your job. Quite honestly, most websites done with php have so many bad practices it is not true. No separation of concerns. DB access directly from the pages, etc. Not good architecture. Not worth learning or adopting. php does not lend itself to great architectural design. I will probably be flamed for the last statement, but that is my opinion.

I cannot agree more, but it is part of my current job so learning php would be of great benefit to me at the current moment.

This is what I am trying to achieve, just a simpler version of this, aimed at very small scale businesses

http://ultimateclientmanager.com/demo_free/
 
Correct, but a scripting language promotes bad practices because it cannot help it while proper OO-languages give you the opportunity to create a great architecture. MVC a case in point. Separation of M/V/C which is very important. But we are 'jacking the thread.

Scripting just gives you more freedom its kind of blaming your car for speeding when you full well know the rules. Agile has the same issues people make excuses for skirting around the rules but they still exist. I think its on topic, this is an educational thread about design and architecture as much as anything else.
 
An ERP system is all about the backend (database/classes/objects) which can easily be used to build (or generate) your forms with.

If you look at SAP , everything starts by creating a data object. In plain language : a database table, the column definitions and all the methods to work with this object , i.e. how to insert,update,delete into this object and how this object relates to other objects . Once you have this and if you are using a MVC type of framework , the actual search/forms/reports/admin of this object will start literally happening by itself (literally). So sure you can build your forms from scratch , but this will catch up to you once you start maintaining 50 forms for every change to the database, you do not want to do this, trust me.

Anyway, as someone mentioned , the MVC framework (or variations of it) is what you should look at. MVC is a design philosophy / principle and every programming language have a framework for this, i'm not so sure about PHP these days (CakePHP ?) , but last i checked this is exactly why Ruby on Rails is popular in this arena . C#/.NET have their MVC projects , and if you like Python, then something like Django is another MVC framework that is really amazing to work with (and easy to learn).

Django (and i'm sure a few others, SAP ABAP coding works on the same principle) goes as far as being able to generate entire forms (i.e. datefields / dropdowns /list boxes and what is in these dropdowns) purely from your models without you even coding one line (other than defining your models and linking their relations). All you actually do is configure the theme/look of the forms, you don't actually program each button/dropdown yourself .... and that is how you can then have 50 forms and making one change to the model will automatically update all 50 forms.

On the Microsoft side of things, this is what Microsoft Lightswitch is, you design your database/foreign keys/relations aka "model" and then you just turn on the light...


So in short : CakePHP / Rails / Django , start there.

https://www.djangoproject.com/
http://rubyonrails.org/

and i don't know this very well, but CakePHP is probably where i'd start looking if i absolutely need to do this all in PHP: http://cakephp.org/
 
Last edited:
An ERP system is all about the backend (database/classes/objects) which can easily be used to build (or generate) your forms with.

If you look at SAP , everything starts by creating a data object. In plain language : a database table, the column definitions and all the methods to work with this object , i.e. how to insert,update,delete into this object and how this object relates to other objects . Once you have this and if you are using a MVC type of framework , the actual search/forms/reports/admin of this object will start literally happening by itself (literally). So sure you can build your forms from scratch , but this will catch up to you once you start maintaining 50 forms for every change to the database, you do not want to do this, trust me.

Anyway, as someone mentioned , the MVC framework (or variations of it) is what you should look at. MVC is a design philosophy / principle and every programming language have a framework for this, i'm not so sure about PHP these days (CakePHP ?) , but last i checked this is exactly why Ruby on Rails is popular in this arena . C#/.NET have their MVC projects , and if you like Python, then something like Django is another MVC framework that is really amazing to work with (and easy to learn).

Django (and i'm sure a few others) goes as far as being able to generate entire forms (i.e. datefields / dropdowns /list boxes and what is in these dropdowns) purely from your models without you even coding one line (other than defining your models and linking their relations). All you actually do is configure the theme/look of the forms, you don't actually program each button/dropdown yourself .... and that is how you can then have 50 forms and making one change to the model will automatically update all 50 forms.

On the Microsoft side of things, this is what Microsoft Lightswitch is, you design your database/foreign keys/relations aka "model" and then you just turn on the light...


So in short : CakePHP / Rails / Django , start there.

https://www.djangoproject.com/
http://rubyonrails.org/

and i don't know this very well, but CakePHP is probably where i'd start looking if i absolutely need to do this all in PHP: http://cakephp.org/

You sir, you sir need a beer! Thank you for this, this actually is brilliant stuff as I just realized I wont want to edit each individual form etc after everything adds up etc.

I have heard about django before and I have played with python before, python felt a lot like php at times so i think I will be able to adapt fairly easily.

Now the real work begins; [logic]Creating a wireframe of some sorts to show exactly what I want and how it all must connect.
 
An ERP system is all about the backend (database/classes/objects) which can easily be used to build (or generate) your forms with.

If you look at SAP , everything starts by creating a data object. In plain language : a database table, the column definitions and all the methods to work with this object , i.e. how to insert,update,delete into this object and how this object relates to other objects . Once you have this and if you are using a MVC type of framework , the actual search/forms/reports/admin of this object will start literally happening by itself (literally). So sure you can build your forms from scratch , but this will catch up to you once you start maintaining 50 forms for every change to the database, you do not want to do this, trust me.

Anyway, as someone mentioned , the MVC framework (or variations of it) is what you should look at. MVC is a design philosophy / principle and every programming language have a framework for this, i'm not so sure about PHP these days (CakePHP ?) , but last i checked this is exactly why Ruby on Rails is popular in this arena . C#/.NET have their MVC projects , and if you like Python, then something like Django is another MVC framework that is really amazing to work with (and easy to learn).

Django (and i'm sure a few others, SAP ABAP coding works on the same principle) goes as far as being able to generate entire forms (i.e. datefields / dropdowns /list boxes and what is in these dropdowns) purely from your models without you even coding one line (other than defining your models and linking their relations). All you actually do is configure the theme/look of the forms, you don't actually program each button/dropdown yourself .... and that is how you can then have 50 forms and making one change to the model will automatically update all 50 forms.

On the Microsoft side of things, this is what Microsoft Lightswitch is, you design your database/foreign keys/relations aka "model" and then you just turn on the light...


So in short : CakePHP / Rails / Django , start there.

https://www.djangoproject.com/
http://rubyonrails.org/

and i don't know this very well, but CakePHP is probably where i'd start looking if i absolutely need to do this all in PHP: http://cakephp.org/

Totally agree. But the OP wants to / has to learn php for work. But from the point of where he want to progress to, he should focus on the analysis side rather that deciding what stack to use.
 
Totally agree. But the OP wants to / has to learn php for work. But from the point of where he want to progress to, he should focus on the analysis side rather that deciding what stack to use.

Yea, so then i suggest he starts looking at CakePHP (i'm sure there are a zillion options for this, CakePHP is just one i have seen alot). This should at least give the OP a good idea of how to design a system like this and ensuring you don't build something that is totally impossible to maintain.

ERP systems have zillions of screens/transactions, and alot of them are just variations of the exact same form, purely because each business wants to create invoices just a little different from another business (i.e. less fields/ more fields ) . So if you go and create a form for every situation and then one day decide to change a CHAR(50) field to CHAR(500) , guess what! You will be changing all those forms one by one, worse, you will not even KNOW which forms to change! ...MVC actually teach you how to deal with this problem .
 
Last edited:
Yea, so then i suggest he starts looking at CakePHP (i'm sure there are a zillion options for this, CakePHP is just one i have seen alot). This should at least give the OP a good idea of how to design a system like this and ensuring you don't build something that is totally impossible to maintain.

ERP systems have zillions of screens/transactions, and alot of them are just variations of the exact same form, purely because each business wants to create invoices just a little different from another business (i.e. less fields/ more fields ) . So if you go and create a form for every situation and then one day decide to change a CHAR(50) field to CHAR(500) , guess what! You will be changing all those forms one by one, worse, you will not even KNOW which forms to change! ...MVC actually teach you how to deal with this problem .

Correct, metadata and design patterns are key here. Metadata can tell your code how to build a form and what objects relate to others. .NET is great in this area. Design patterns minimise the code you have to write if you use generics to implement these patterns. Also improves quality through extensive reuse of those classes. Also good idea to identify patterns in your UX so that it is consistent.
 
Thor187,

you've done some php, hooked some forms up to the database, saving your info, etc.
To do what you want to do now you need to start looking at frameworks.

Not using a framework is fine for what you have done so far. To do this 'mini' ERP system that you want without a framework is going to result in a lot of lines of not the greatest code being written, frustration from debugging and pulling out your hair when you're wanting to add on something later on.

Have a look at symphony (I've not used it but it's all the rage with the cool kids) and if that doesn't make sense then check out Yii.

With both of them you will still be writing php but you'll be doing it 'better'.
Personally - I used cakephp a long time ago and found it very difficult to get into. I then switched to Yii and it clicked with me. I briefly tried symphony a bit back and it didn't make sense but a friend of mine understood it within an hour or 2 .. so each to their own.

Please don't hand code a system like this, there is almost No situation, Ever, where you will have to do that. If your boss says that you need to do it all yourself then it's time to look for a different company.

Frameworks help speed up development and keep your separation of concerns, all that stuff spoken about above by Spacerat and Beachless as they usually enforce the MVC model. They also take care of your database - syou you don't have to worry about interacting with your MySQL/Postgres/Oracle/innodb yourself, you create an instance of yourmodela dn save it, the framework worries about putting the data into the database correctly.

This is done something like (ALL this code is pseudo code and could be a combo of php and js ):

In your User Model file:

User = {
id: {type: auto-increment, primary: true},
username: {type: string, unique:true},
password: {type: string, min:6, max:8 },
email: {type: email, unique: true}
}

In your Controller file:
//create a new user
$user1 = new User({username: 'Thor', password:'187', email:'[email protected]'});

//Or create a new user using inputs from a POSTed form
$user1 = new User({username: $_POST['username'], password:$_POST['password'], email:$_POST['email']});

Then you update the users email address and save the record to the database:
$user->email = '[email protected]';
$user->save();



That's the kind of functionality that your framework should give you.

It should have hooks where you can do stuff like encrypt the password before saving it to the db:

In your User model file:

function before_user_save_hook($user) {
if(isset(user->password) {
$user->password = md5($user->password);
}

return $user;
}


Go read up about frameworks, they all work in a similar fashion these days.
Get some theory behind you and then the practice may start to make sense..


Also - frameworks have generally got a lot of plugins that have done most of the stuff you need - authentication, social plugins, etc.
Rather create a test app, load in the plugin and then step through their code than rewrite it all yourself.
If you want to create the ERP system in the next 20 days then there's no point in struggling with Oath authentication for 10 days..


Check:
http://phpframeworks.com/
http://codeigniter.com/
https://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#PHP
http://symfony.com/why-use-a-framework
 
Thor187,

you've done some php, hooked some forms up to the database, saving your info, etc.
To do what you want to do now you need to start looking at frameworks.

Not using a framework is fine for what you have done so far. To do this 'mini' ERP system that you want without a framework is going to result in a lot of lines of not the greatest code being written, frustration from debugging and pulling out your hair when you're wanting to add on something later on.

Have a look at symphony (I've not used it but it's all the rage with the cool kids) and if that doesn't make sense then check out Yii.

With both of them you will still be writing php but you'll be doing it 'better'.
Personally - I used cakephp a long time ago and found it very difficult to get into. I then switched to Yii and it clicked with me. I briefly tried symphony a bit back and it didn't make sense but a friend of mine understood it within an hour or 2 .. so each to their own.

Please don't hand code a system like this, there is almost No situation, Ever, where you will have to do that. If your boss says that you need to do it all yourself then it's time to look for a different company.

Frameworks help speed up development and keep your separation of concerns, all that stuff spoken about above by Spacerat and Beachless as they usually enforce the MVC model. They also take care of your database - syou you don't have to worry about interacting with your MySQL/Postgres/Oracle/innodb yourself, you create an instance of yourmodela dn save it, the framework worries about putting the data into the database correctly.

This is done something like (ALL this code is pseudo code and could be a combo of php and js ):

In your User Model file:

User = {
id: {type: auto-increment, primary: true},
username: {type: string, unique:true},
password: {type: string, min:6, max:8 },
email: {type: email, unique: true}
}

In your Controller file:
//create a new user
$user1 = new User({username: 'Thor', password:'187', email:'[email protected]'});

//Or create a new user using inputs from a POSTed form
$user1 = new User({username: $_POST['username'], password:$_POST['password'], email:$_POST['email']});

Then you update the users email address and save the record to the database:
$user->email = '[email protected]';
$user->save();



That's the kind of functionality that your framework should give you.

It should have hooks where you can do stuff like encrypt the password before saving it to the db:

In your User model file:

function before_user_save_hook($user) {
if(isset(user->password) {
$user->password = md5($user->password);
}

return $user;
}


Go read up about frameworks, they all work in a similar fashion these days.
Get some theory behind you and then the practice may start to make sense..


Also - frameworks have generally got a lot of plugins that have done most of the stuff you need - authentication, social plugins, etc.
Rather create a test app, load in the plugin and then step through their code than rewrite it all yourself.
If you want to create the ERP system in the next 20 days then there's no point in struggling with Oath authentication for 10 days..


Check:
http://phpframeworks.com/
http://codeigniter.com/
https://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#PHP
http://symfony.com/why-use-a-framework

I love you. I really do. I am going to see which one I "snap" the easiest between symphony and Yii. Actually have looked at them before and Yii looked easier than symphony. ( Easier to/for me, don't get me wrong )
 
I'm just afraid of php frameworks, because I actually don't know where to begin like the very beginning.

For instance the only "framework" I have used is bootstrap and all I needed to run was wamp + browser + localhost
 
I'm just afraid of php frameworks, because I actually don't know where to begin like the very beginning.

For instance the only "framework" I have used is bootstrap and all I needed to run was wamp + browser + localhost

It is a little intimidating and weird at first.

Since you're looking at Yii, start with this: http://www.larryullman.com/series/learning-the-yii-framework/ he creates a complete web app step by step.

Also check: http://www.yiiframework.com/tutorials/

It may be a good idea to read through it all first and then go through it again and do the actual code..
 
Are you wanting to develop this ERP system as a learning experience or are you just looking for an invoicing solution?

If you'e looking to use existing stuff then
Check freshbooks.com , zoho.com and a host of others for invoicing and ERP.

Also check podio.com - you can easlity create an invoicing type app.

They also have APIs you can tie into so you can half 'create your own' and half 'not re-invent the wheel'.
 
Holy macaroni THIS is Exactly what I want.! I wish I had the experience to build this and not have to buy it. ( Login email/ Password : [email protected]/ 12345 )

In all honesty, if you are using a good platform + framework , you can build that in a day. Something like Django even generates a whole "dashboard" or "admin interface" for you by default (so those "manage clients" , "manage products" screens + entire security login stuff are all generated for you). The only screen that would need some energy from you side would be the invoice creation screen.....but if your model/meta data is set up correctly, it is all cake.
 
Last edited:
figure out how to create your own Yii project and do a simple app, basically follow the tutorial I posted earlier.

Then grab this and see what it's about:
https://github.com/germandosko/afipweb

A brief glance shows it has model files for Login, Customers, Resellers and Invoices.
 
Are you wanting to develop this ERP system as a learning experience or are you just looking for an invoicing solution?
yes also confused. why would you buy a solution if you want to learn how to do it.
 
Are you wanting to develop this ERP system as a learning experience or are you just looking for an invoicing solution?

If you'e looking to use existing stuff then
Check freshbooks.com , zoho.com and a host of others for invoicing and ERP.

Also check podio.com - you can easlity create an invoicing type app.

They also have APIs you can tie into so you can half 'create your own' and half 'not re-invent the wheel'.

In all honesty, if you are using a good platform + framework , you can build that in a day. Something like Django even generates a whole "dashboard" or "admin interface" for you by default (so those "manage clients" , "manage products" screens + entire security login stuff are all generated for you). The only screen that would need some energy from you side would be the invoice creation screen.....but if your model/meta data is set up correctly, it is all cake.

figure out how to create your own Yii project and do a simple app, basically follow the tutorial I posted earlier.

Then grab this and see what it's about:
https://github.com/germandosko/afipweb

A brief glance shows it has model files for Login, Customers, Resellers and Invoices.

yes also confused. why would you buy a solution if you want to learn how to do it.

Sorry not meant like that, I'm not going to buy it, just wished my skill level was on par so I could built that already.


I am going to try and build that using Yii that is my project now

Hope this clears everything up.
 
Top
Sign up to the MyBroadband newsletter
X