Skip to content

Commit 2b08e8c

Browse files
committed
add README and text to homepage
1 parent a3f57e3 commit 2b08e8c

29 files changed

+1354
-61
lines changed

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ APP_SECRET=0aabd8ac1e1554db5b50ca9d54ad796c
2828
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
2929
DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8"
3030
###< doctrine/doctrine-bundle ###
31+
32+
###> nelmio/cors-bundle ###
33+
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
34+
###< nelmio/cors-bundle ###
File renamed without changes.

Procfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
web: vendor/bin/heroku-php-nginx -C nginx.conf -F fpm_custom.conf public/
2+
# release: bin/console tailwind:build && bin/console importmap:install && bin/console asset-map:compile
3+

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This application is a PWA (Progressive Web Application) built with Symfony and PHPWA.
66

7-
## Getting Started
7+
## Getting Started (Docker)
88

99

1010
### With Docker
@@ -28,6 +28,12 @@ This application is a PWA (Progressive Web Application) built with Symfony and P
2828
8. Open `https://localhost:8000` in your favorite web browser
2929
9. Run `symfony server:stop` to stop the server
3030

31+
## Getting Started
32+
33+
Install Symfony CLI and PostgreSQL
34+
35+
bin/console d:d:c
36+
3137
## License
3238

3339
It is available under the MIT License.

app.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "phpwa-demo",
3+
"description": "A repo, maybe get this from github",
4+
"keywords": [
5+
"php",
6+
"symfony"
7+
],
8+
"repository": "https:\/\/github.com\/survos-sites\/phpwa-demo",
9+
"scripts": {
10+
"dokku": {
11+
"predeploy": "bin/console tailwind:build && bin\/console importmap:install && bin\/console asset-map:compile",
12+
"postdeploy": ""
13+
}
14+
},
15+
"env": {
16+
"SECRET_TOKEN": {
17+
"description": "A secret key for verifying the integrity of signed cookies.",
18+
"value": "secret"
19+
},
20+
"WEB_CONCURRENCY": {
21+
"description": "The number of processes to run.",
22+
"generator": "echo 5"
23+
}
24+
},
25+
"image": "gliderlabs\/herokuish",
26+
"addons": [
27+
"dokku-postgres",
28+
"dokku-redis"
29+
],
30+
"buildpacks": [
31+
{
32+
"url": "https:\/\/github.com\/heroku\/heroku-buildpack-php.git"
33+
}
34+
]
35+
}

assets/bootstrap.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { startStimulusApp } from '@symfony/stimulus-bundle';
2+
import Timeago from 'stimulus-timeago'
23

34
const app = startStimulusApp();
45
// register any custom, 3rd party controllers here
5-
// app.register('some_controller_name', SomeImportedController);
6+
app.register('timeago', Timeago);

assets/controllers/hello_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import { Controller } from '@hotwired/stimulus';
1111
*/
1212
export default class extends Controller {
1313
connect() {
14-
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
14+
this.element.textContent = 'Hello, welcome to phpwa-demo!';
1515
}
1616
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { Controller } from '@hotwired/stimulus';
2+
3+
/*
4+
* The following line makes this controller "lazy": it won't be downloaded until needed
5+
* See https://github.com/symfony/stimulus-bridge#lazy-controllers
6+
*/
7+
/* stimulusFetch: 'lazy' */
8+
export default class extends Controller {
9+
static targets = ['list', 'message']
10+
static values = {
11+
collectionUrl: String,
12+
}
13+
// ...
14+
connect() {
15+
this.messageTarget.innerHTML = 'fetching ' + this.collectionUrlValue;
16+
this.loadList();
17+
}
18+
19+
20+
async loadList() {
21+
try {
22+
// this endpoint will return CORS error
23+
const response = await fetch(this.collectionUrlValue);
24+
if (!response.ok) {
25+
throw new Error("Network response was not OK");
26+
this.errorTarget.innerHTML = 'unable to fetch items at this time.';
27+
console.error('Failed');
28+
return;
29+
} else {
30+
// promise resolved.
31+
const items = await response.json();
32+
const count = items['hydra:totalItems'];
33+
this.messageTarget.innerHTML = `${count} total items`;
34+
35+
this.listTarget.innerHTML = '<ol>'
36+
for (const item of items['hydra:member']) {
37+
// this.listTarget.innerHTML += `<li>${item.name}</li>`;
38+
console.log(item);
39+
}
40+
this.listTarget.innerHTML += `</ol>`;
41+
42+
console.log(items);
43+
44+
}
45+
} catch {
46+
this.messageTarget.innerHTML = 'unable to fetch items at this time.';
47+
console.error('Failed');
48+
return;
49+
}
50+
}
51+
52+
refresh() {
53+
this.loadList();
54+
}
55+
56+
}

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@
1010
"ext-ctype": "*",
1111
"ext-iconv": "*",
1212
"ext-imagick": "*",
13+
"api-platform/core": "^3.2",
1314
"doctrine/dbal": "^3",
1415
"doctrine/doctrine-bundle": "^2.11",
1516
"doctrine/doctrine-migrations-bundle": "^3.3",
1617
"doctrine/orm": "^3.0",
1718
"knplabs/knp-time-bundle": "^2.2",
19+
"nelmio/cors-bundle": "^2.4",
1820
"phpdocumentor/reflection-docblock": "^5.3",
1921
"phpstan/phpdoc-parser": "^1.25",
2022
"spomky-labs/phpwa": "^1.0",
23+
"survos/deployment-bundle": "^1.5",
2124
"symfony/asset": "7.0.*",
22-
"symfony/asset-mapper": "7.0.*",
25+
"symfony/asset-mapper": "7.0.3",
2326
"symfony/clock": "7.0.*",
2427
"symfony/console": "7.0.*",
2528
"symfony/dotenv": "7.0.*",
@@ -35,6 +38,7 @@
3538
"symfony/property-access": "7.0.*",
3639
"symfony/property-info": "7.0.*",
3740
"symfony/runtime": "7.0.*",
41+
"symfony/security-bundle": "7.0.*",
3842
"symfony/serializer": "7.0.*",
3943
"symfony/stimulus-bundle": "^2.13",
4044
"symfony/string": "7.0.*",

0 commit comments

Comments
 (0)