Skip to content

Instantly share code, notes, and snippets.

@vovanmix
Created January 14, 2016 17:22
Show Gist options
  • Save vovanmix/f74c2423fe49d7b76752 to your computer and use it in GitHub Desktop.
Save vovanmix/f74c2423fe49d7b76752 to your computer and use it in GitHub Desktop.

#Main idea Big files with code are very hard to maintain. I suggest to limit files size to 100 +- rows, splitting hard logic to smaller parts and moving them to separate files

#PHP Controllers should serve just as buffer between HTTP interface and the app. They should define Actions and call methods defined in Models, Repositories, Services etc. Processing logic related to handling one single record can be moved to Model. Processing logic related to handling a set of records of one type can be moved to Repository. Logic related to a specific subject can be moved to a separate Service. Common functionalities can be moved to parent abstract classes.

#Blade templates If a template has a lot of big sections, we can create a folder instead of a file, put a "page.blade.php" file inside and reference this file in the controller. All sections can be moved to separate files inside this folder, their names should start with "". We can continue to decompose sections, splitting them ro parts, starting with "_".

#CSS Styles of every big page or big element could be written in separate files. This files will be joined by Gulp later.

#JS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment