diff --git a/docs/get-started.md b/docs/get-started.md index d3ba559..cc6ff66 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -12,13 +12,16 @@ Installation composer require koded/framework ``` -```json -{ - "require": { - "koded/framework": "^1" - } -} -``` +!!! info "No composer?" + If you don't have `composer` please follow the [download][composer] + instructions how to install it on your OS. + + For manual install on Linux you may run this command: + + ```sh + curl https://getcomposer.org/download/latest-stable/composer.phar -o /usr/local/bin/composer \ + && chmod +x /usr/local/bin/composer + ``` App basics ---------- @@ -27,7 +30,7 @@ App basics **It is up to you how you're going to structure your project.** A simple and clear structuring is essential for great development, -on a along run (or short too), but that is up to developer needs, +on a long run (or short too), but that is up to developer needs, or based on the app complexity, team decisions, or various other reasons. Let's look at something that is good in general as a startup, @@ -35,7 +38,7 @@ Let's look at something that is good in general as a startup, ``` app/ .env -public/ +html/ .htaccess index.php vendor/ @@ -46,17 +49,64 @@ Everything regarding your application goes into the `app/` folder. This is an example, `app` is not a requirement and it can be anything you want. !!! warning "Protect your code!" - It is important to keep everything outside the `public/` folder + It is important to keep everything outside the `html/` folder (`app/`, `vendor/` or anything that is app related and may expose the code). Make sure the app code is not accessible from the outside. +### composer.json + +A `composer.json` scaffold for your project. Run `composer update` every time +a new class is added, or use `psr-4` in `autoload` section while you develop +the app, whatever you prefer most. + +```json +{ + "require": { + "koded/framework": "^1" + }, + "autoload": { + "classmap": [ + "app" + ], + "exclude-from-classmap": [ + "html" + ] + }, + "config": { + "optimize-autoloader": true + } +} +``` + +### Docker (quick example) + +You can jumpstart the development with `docker` and `docker-compose` +with the above app file structure. + +```yaml +# docker-compose.yaml + +version: '3' + +services: + php: + image: php:8-apache + ports: + - 8080:80 + volumes: + - .:/var/www +``` + +Adjust the volumes, or the host port if it's already taken. +Run `docker-compose up -d` and open your browser at `127.0.0.1:8080` + ### App entry point -The simplest way to start is to create the "entry script" for all -HTTP requests. There we create an instance of `App` and define the URI routes. +Create the "entry script" for all HTTP requests. +There we create an instance of `App` and define the URI routes. ``` php -# /path/to/public/index.php +# /var/www/html/index.php