Question on file organisation!

Question on file organisation!

TGDesigns

Member
Local time
18:23
Joined
Nov 20, 2019
Messages
89

Hi all!

Im a single self taught developer working at a small company with no other developers, im worried im picking up bad habits or doing things wrong! So my question to you is am I organising my current project correctly?
I have put in a link to an imgur album of my file tree, I cant seem to get the insert image thing to work on here! I have a fair amount of Ajax call spread over separate pages and opted to store them all separately inside of a "js" file and a "helpers" file that contains all of the php files that are called by ajax.

How would you go about doing this? This is my first time using ajax and want to learn the right way instead of having to re learn later!

Thanks in advanced!

Greg

 

adam

Mr. Webwide
Administrator
Local time
18:23
Joined
Sep 24, 2019
Messages
1,264
Pronouns
he/him

Seems like quite a big project. I assume you are going framework-less? One of the best things about frameworks are a good structure.

Are you trying to follow any kind of particular methodology already? There is not necessarily a right one but interested to hear what you are going for.

 

TGDesigns

Member
Local time
18:23
Joined
Nov 20, 2019
Messages
89

Seems like quite a big project. I assume you are going framework-less? One of the best things about frameworks are a good structure.

Are you trying to follow any kind of particular methodology already? There is not necessarily a right one but interested to hear what you are going for.

If im honest it started out as a pretty small project but got a bit bog for its boots! Its also my first time using a templating library of which im using smarty.

Im not really following any standard other than java-script in js files helpers in the helper folder and classes in the class folder.
My issue was time I needed to have a minimum viable done in about 3 days and im not very confident with frameworks so I just sort of did what I knew!

 

tom

Creator of StickerRun®
Local time
19:23
Joined
Oct 13, 2019
Messages
258

First things first, if you are working with composer, please think about using a public directory that you are setting as your docroot for your webserver.
Now, all your files are exposed to the web (if you don't have any blacklists in place) which is a huge security risk. Have a look at the Laravel boilerplate structure, it has a public directory where an index.php file is more or less starting the frameworks processes -> laravel/laravel

If you can't use a public directory, use a .htaccess file to forbid access to specific files and directories of your project eg. the vendor folder, .htaccess, .htpasswd and so on.
Also don't make class files directly accessible or custom tools/helpers and likewise as this may lead to security risks too.

 
Last edited:

TGDesigns

Member
Local time
18:23
Joined
Nov 20, 2019
Messages
89

First things first, if you are working with composer, please think about using a public directory that you are setting as your docroot for your webserver.
Now, all your files are exposed to the web (if you don't have any blacklists in place) which is a huge security risk. Have a look at the Laravel boilerplate structure, it has a public directory where an index.php file is more or less starting the frameworks processes -> laravel/laravel

If you can't use a public directory, use a .htaccess file to forbid access to specific files and directories of your project eg. the vendor folder, .htaccess, .htpasswd and so on.
Also don't make class files directly accessible or custom tools/helpers and likewise as this may lead to security risks too.

Thanks for the reply Tom I appreciate it I should probably mention the above images are from my development machine, the server that the site is used from is also an internal only server but does have a ht-access file to only allow the index and other base page files. I agree completely though I really should learn a framework I just haven't found a tutorial thats really stuck as of yet, I learn much easier through making a project with a hands on approach rather than doing a tutorial that just shows the basics!

I guess auto-loading my own classes through composer would also be a good thing to do! This project unfortunatly has forced me to learn lots of new things in one go and its quickly becoming overwhelming!

 
Last edited:

TGDesigns

Member
Local time
18:23
Joined
Nov 20, 2019
Messages
89

I'd say if you've got a tight deadline on it, don't worry about learning the right way, just get it done. You can use any advice you get here on the rewrite.
Thanks Mike, fortunately I managed to get what I needed to done for the tight deadline and now im exploring turning it into a usable tool thats a bit more robust. Thats why im now seeking out advice :D

 

blaq

🌱
Local time
13:23
Joined
Oct 18, 2019
Messages
48

Seems like quite a big project. I assume you are going framework-less? One of the best things about frameworks are a good structure.
disagree and agree on less time spent on building the project but it can be really challenging to maintain when these frameworks get updated ...
building your own from scratch is the best way as you only create and add what you need ... and its easier to maintain.

 

TGDesigns

Member
Local time
18:23
Joined
Nov 20, 2019
Messages
89

To be fair I think most people would be fine with a framework im just terrible at learning haha

 

blaq

🌱
Local time
13:23
Joined
Oct 18, 2019
Messages
48

To be fair I think most people would be fine with a framework im just terrible at learning haha
yeah! but its the most horrible thing when you work at a company and your job is to update or work on a framework that is 10 years old...

 

TGDesigns

Member
Local time
18:23
Joined
Nov 20, 2019
Messages
89

I think your right Gummi I really need to move the whole thing into a framework and just force myself to learn a framework at the same time, the problem I had with trying to learn was that I would follow a course and understand it and then think "Right now its time to add a templating engine" and then find out that I should have added it from the start haha

 

Gummibeer

Astroneer
Moderator
Local time
19:23
Joined
Oct 5, 2019
Messages
1,187
Pronouns
he/him

I think your right Gummi I really need to move the whole thing into a framework and just force myself to learn a framework at the same time, the problem I had with trying to learn was that I would follow a course and understand it and then think "Right now its time to add a templating engine" and then find out that I should have added it from the start haha
It's okay to do a MVP with what you know best. But there should be a point, in best case defined and communicated upfront, when to trash everything and switch to a reliable structure.
Most bosses don't like it and want to build forever on the prototype. Because they don't see a reason to spend weeks or even months only to rework what's already present.
But it's worth it if the project should be maintainable for more years.
And with Laravel 7 in reach you will have a beautiful time to switch to it. 😉

 

TGDesigns

Member
Local time
18:23
Joined
Nov 20, 2019
Messages
89

It's okay to do a MVP with what you know best. But there should be a point, in best case defined and communicated upfront, when to trash everything and switch to a reliable structure.
Most bosses don't like it and want to build forever on the prototype. Because they don't see a reason to spend weeks or even months only to rework what's already present.
But it's worth it if the project should be maintainable for more years.
And with Laravel 7 in reach you will have a beautiful time to switch to it. 😉
On a side note Gummi do you know/have any experience with using smarty + laravel instead of blade?

 

Gummibeer

Astroneer
Moderator
Local time
19:23
Joined
Oct 5, 2019
Messages
1,187
Pronouns
he/him

On a side note Gummi do you know/have any experience with using smarty + laravel instead of blade?
No experience, but I know and have done that switching to twig is easy. There's a smarty package: ytake/Laravel.Smarty but no idea if it's good. But I recommend to stick with blade. With Laravel 7 it gets super powers and otherwise you have to translate all tutorials.

 

Gummibeer

Astroneer
Moderator
Local time
19:23
Joined
Oct 5, 2019
Messages
1,187
Pronouns
he/him

Dont wanna keep reviving a dead thread but Would you say this is a good place to start learning laravel 6 gummi? Laracasts
Like said: Laracasts is the best! Not only for Laravel. They also cover Vue, database and so on.
So YES. 😉

 
Top