An open API service indexing awesome lists of open source software.

https://github.com/victorfleite/wwalerts-backend

Open source spatial and geographic platform to create and show the last severe alerts based on CAP (Common Alert Protocol). Front-end (Twitter Bootstrap, Javascript, JQuery) and Back-end (Php, Yii2, Postgres, Postgis, Restful, Api, Json). This platform have been created to help the meteorologic agencies to predict severe events and create CAP.
https://github.com/victorfleite/wwalerts-backend

alert alerts geographic insert json-api oop php postgresql prediction security spatial wheather wheather-app wmo yii2

Last synced: 22 days ago
JSON representation

Open source spatial and geographic platform to create and show the last severe alerts based on CAP (Common Alert Protocol). Front-end (Twitter Bootstrap, Javascript, JQuery) and Back-end (Php, Yii2, Postgres, Postgis, Restful, Api, Json). This platform have been created to help the meteorologic agencies to predict severe events and create CAP.

Awesome Lists containing this project

README

        

# WWALERTS

This project is a platform + api to create alerts of severe events of meteorology. Its also creates the CAP (v1.2) files ([Common Alert Protocol](http://docs.oasis-open.org/emergency/cap/v1.2/CAP-v1.2-os.html))

## INSTALLATION

Create a new repository

1. $ git clone [email protected]:victorfleite/wwalerts-backend.git wwalert

Install Composer. For [more](https://getcomposer.org/doc/).

2. $ curl -sS https://getcomposer.org/installer | php
3. $ sudo mv composer.phar /usr/local/bin/composer
4. $ sudo chown -fR yourUser:root /usr/local/bin/composer
5. $ sudo composer global require "fxp/composer-asset-plugin:^1.3.1"
Update Composer

6. $ cd yourFolderName
7. $ composer update
8. Create your local database

```php
9. Set the database configuration on common/config/main-local.php
[
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=localhost;dbname=databasename',
'username' => 'postgres',
'password' => 'postgres',
'charset' => 'utf8',
],
...
],
];
```
10. $ sudo chmod 777 /var/www/html/yourFolderName/backend/web/assets

## USAGE

Access you application on `http://localhost/wwalert`

Insert the username: victor.leite

Insert the password: mypassword

Login into the system (You have the administrator role) :-)

### EXEMPLE API CALLS
-------------------

```
1. Token access required
curl -i -H "Accept:application/json" -H "Content-Type:application/json" "http://localhost/yourFolderName/service/api/www/index.php/oauth2/token" -XPOST \
-d '{"grant_type":"password","username":"[email protected]","password":"mypassword","client_id":"myclientId","client_secret":"mySecretPassword"}'

2. Token access required with scope
curl -i -H "Accept:application/json" -H "Content-Type:application/json" "http://localhost/yourFolderName/service/api/www/index.php/oauth2/token" -XPOST \
-d '{"grant_type":"password","username":"[email protected]","password":"mypassword","client_id":"myclientId","client_secret":"mySecretPassword","scope":"custom"}'

3 - User data required
curl -i -H "Accept:application/json" -H "Content-Type:application/json" "http://localhost/yourFolderName/service/api/www/index.php/v1/user/get-user?access_token={TOKEN_GERADO_NA_AUTENTICACAO}"
```

## CONTRIBUTION

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## HISTORY

I decided to create this project to help people to accelerate the proccess to create application and services/api rest in the same project.

## CREDITS

[mdmsoft/yii2-admin](https://github.com/mdmsoft/yii2-admin)

[filsh/yii2-oauth2-server](https://github.com/Filsh/yii2-oauth2-server)

[mootensai/yii2-enhanced-gii](https://github.com/mootensai/yii2-enhanced-gii)

## LICENCE

The MIT License

===============================

## DIRECTORY STRUCTURE
-------------------

```
backend
assets/ contains application assets such as JavaScript and CSS
config/ contains backend configurations
controllers/ contains Web controller classes
models/ contains backend-specific model classes
runtime/ contains files generated during runtime
tests/ contains tests for backend application
views/ contains view files for the Web application
web/ contains the entry script and Web resources
widgets/ contains widgets for the Web application
common
config/ contains shared configurations
mail/ contains view files for e-mails
models/ contains model classes used in both backend and frontend
tests/ contains tests for common classes
console
config/ contains console configurations
controllers/ contains console controllers (commands)
migrations/ contains database migrations
models/ contains console-specific model classes
runtime/ contains files generated during runtime
service
api/common/ contains controllers or models commons for api application
api/components/ contains components that could be inherited by classes and controllers in each version (ex: versions/v1)
api/config/ contains shared configurations
api/versions/ versions of application
api/www/ initial folder for application
vendor/ contains dependent 3rd-party packages
```

===============================