Created
August 2, 2016 10:07
-
-
Save DaveRandom/f16d8529de3a5095e46a8422aaa6fa4d to your computer and use it in GitHub Desktop.
Default repository layout - PHP web application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vendor # ignore composer data | |
# ignore PHP Storm config | |
# you may want to ignore your IDE config and you may want to commit it, up to you | |
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// ... | |
"autoload": { | |
"psr-4": { "MyAppNamespace\\": "src/" }, | |
"files": ["src/functions.php"] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this just ignores everything in this folder, while allowing you to commit the "empty" folder to git | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| | |
+- .git | |
+- [public] # this is the web server document root, all requests for URIs that don't point to existing files are routed to index.php | |
| +- [static] | |
| | +- # static files; CSS, JS, images etc | |
| +- index.php | |
+- [config] | |
| +- .gitignore | |
+- [src] | |
| +- <PSR-4 namespaced classes> | |
| +- launcher.php | |
| +- bootstrap.php | |
| +- functions.php # there may be more than one of these, e.g. for different namespaces | |
+- .gitignore | |
+- .gitattributes | |
+- composer.json | |
+- composer.lock | |
+- readme.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types = 1); | |
require __DIR__ . '/../launcher.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types = 1); | |
namespace MyAppNamespace; | |
require __DIR__ . '/../vendor/autoload.php'; | |
require __DIR__ . '/../config/config.php'; // load app config, may be more complex e.g. JSON/yaml files etc | |
// any other startup actions that are required for every application entry point, e.g. if you have any command line scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types = 1); | |
namespace MyAppNamespace; | |
require __DIR__ . '/bootstrap.php'; | |
// this is the actual entry point for the web application, app logic goes here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment