Skip to content

Commit 726ae26

Browse files
committed
- more details for jumpstarting the development
1 parent 89f809b commit 726ae26

File tree

1 file changed

+66
-15
lines changed

1 file changed

+66
-15
lines changed

docs/get-started.md

Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ Installation
1212
composer require koded/framework
1313
```
1414

15-
```json
16-
{
17-
"require": {
18-
"koded/framework": "^1"
19-
}
20-
}
21-
```
15+
!!! info "No composer?"
16+
If you don't have `composer` please follow the [download][composer]
17+
instructions how to install it on your OS.
18+
19+
For manual install on Linux you may run this command:
20+
21+
```sh
22+
curl https://getcomposer.org/download/latest-stable/composer.phar -o /usr/local/bin/composer \
23+
&& chmod +x /usr/local/bin/composer
24+
```
2225

2326
App basics
2427
----------
@@ -27,15 +30,15 @@ App basics
2730

2831
**It is up to you how you're going to structure your project.**
2932
A simple and clear structuring is essential for great development,
30-
on a along run (or short too), but that is up to developer needs,
33+
on a long run (or short too), but that is up to developer needs,
3134
or based on the app complexity, team decisions, or various other reasons.
3235

3336
Let's look at something that is good in general as a startup,
3437

3538
```
3639
app/
3740
.env
38-
public/
41+
html/
3942
.htaccess
4043
index.php
4144
vendor/
@@ -46,17 +49,64 @@ Everything regarding your application goes into the `app/` folder.
4649
This is an example, `app` is not a requirement and it can be anything you want.
4750

4851
!!! warning "Protect your code!"
49-
It is important to keep everything outside the `public/` folder
52+
It is important to keep everything outside the `html/` folder
5053
(`app/`, `vendor/` or anything that is app related and may expose the code).
5154
Make sure the app code is not accessible from the outside.
5255

56+
### composer.json
57+
58+
A `composer.json` scaffold for your project. Run `composer update` every time
59+
a new class is added, or use `psr-4` in `autoload` section while you develop
60+
the app, whatever you prefer most.
61+
62+
```json
63+
{
64+
"require": {
65+
"koded/framework": "^1"
66+
},
67+
"autoload": {
68+
"classmap": [
69+
"app"
70+
],
71+
"exclude-from-classmap": [
72+
"html"
73+
]
74+
},
75+
"config": {
76+
"optimize-autoloader": true
77+
}
78+
}
79+
```
80+
81+
### Docker (quick example)
82+
83+
You can jumpstart the development with `docker` and `docker-compose`
84+
with the above app file structure.
85+
86+
```yaml
87+
# docker-compose.yaml
88+
89+
version: '3'
90+
91+
services:
92+
php:
93+
image: php:8-apache
94+
ports:
95+
- 8080:80
96+
volumes:
97+
- .:/var/www
98+
```
99+
100+
Adjust the volumes, or the host port if it's already taken.
101+
Run `docker-compose up -d` and open your browser at `127.0.0.1:8080`
102+
53103
### App entry point
54104

55-
The simplest way to start is to create the "entry script" for all
56-
HTTP requests. There we create an instance of `App` and define the URI routes.
105+
Create the "entry script" for all HTTP requests.
106+
There we create an instance of `App` and define the URI routes.
57107

58108
``` php
59-
# /path/to/public/index.php
109+
# /var/www/html/index.php
60110
61111
<?php
62112
@@ -76,12 +126,13 @@ require __DIR__ . '/../vendor/autoload.php';
76126
Now point your browser to app address. It should
77127
print _"Work in Progress..."_ with status code 200.
78128

79-
From here on add more routes to your API, but keep in mind that
129+
From here on add more routes and resources to your API, but keep in mind that
80130
^^using closures as resources is NOT the recommended way^^ to
81131
build the application. For more on this please follow the documentation further.
82132

83133

84134
[php-version]: https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg
85135
[php-link]: https://php.net/
86136
[license-status]: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg
87-
[license-link]: https://github.com/kodeart/koded/LICENSE
137+
[license-link]: https://github.com/kodeart/koded/LICENSE
138+
[composer]: https://getcomposer.org/doc/00-intro.md#globally

0 commit comments

Comments
 (0)