https://github.com/voku/weather-demo
Demo for https://github.com/voku/weather
https://github.com/voku/weather-demo
Last synced: 7 months ago
JSON representation
Demo for https://github.com/voku/weather
- Host: GitHub
- URL: https://github.com/voku/weather-demo
- Owner: voku
- License: mit
- Created: 2023-07-17T09:02:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-25T05:01:27.000Z (12 months ago)
- Last Synced: 2024-10-29T22:48:32.932Z (12 months ago)
- Language: PHP
- Size: 3.89 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/voku/weather-demo/actions)
[](http://codecov.io/github/voku/weather-demo?branch=main)# Weather App (Demo)
### Intro
This demo project is running with middleware concept (PSR-15: HTTP Server Request Handlers):
- FastRoute (https://github.com/nikic/FastRoute) as router
- PHP-DI (https://php-di.org/doc/) as dependency injection container
- Twig (https://twig.symfony.com/) as Template-Engine for the view layer
- PDO [sqlite] (https://www.php.net/manual/en/intro.pdo.php) as database layer
- Weather API Wrapper (https://github.com/voku/weather) as API services### Files
- `/bin/*` -> command line scripts
- `/database/*` -> the sqlite database itself
- `/public/*` -> public web server directory (css, images, ...)
- `/src/*` -> php code
- `/src/framework/*` -> meta code
- `/src/framework/DependencyInjection.php` -> dependency injection definition
- `/src/framework/routing/HttpRouting.php` -> http routing definition
- `/src/modules/*` -> something like packages
- `/src/modules/*/commands/*` -> cli commands
- `/src/modules/*/entities/*` -> data objects
- `/src/modules/*/repositories/*` -> data sources
- `/src/modules/*/services/*` -> services that works with data### Quick start
#### 1. Install the database. ;)
`cp database/_weather.db database/weather.db`
#### 2. start the application
##### 2.1 development
you can just use the build in webserver from php:
`php8.2 -S localhost:8080 -t public/`
##### 2.2 production
you need to point the `root` path to the `public` directory (e.g. for nginx: `root /var/www/weather-demo.suckup.de/web/public;`)
and you need to pass all requests to this path (e.g. for nginx: `if (!-e $request_filename){ rewrite (.*) /index.php?$query_string; }`)