####A parental and privacy control framework for empowering parents to manage the mobile device environments of children on android 5.1+
##Installation: Laravel makes it incredibly easy to deploy the SCkid Web Framework. Our web service has been created with the Laravel (5.2) PHP framework (https://laravel.com) Laravel focuses on MVC design patterns and includes excellent documentation
##Prerequisites:
- Download homestead Virtual Machine https://laravel.com/docs/homestead or setup your own environment
- If you are not using homestead make sure you Install composer for PHP dependencies https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
- Install your webserver, PHP, MySQL and Composer for PHP dependencies
git clone https://github.com/Sp-TT/SCKid.git
Download repository into htdocs or html root- Set up Apache root to point to /var/www/laravel/public
- Create database table for web app
- Edit or create a .env file for Laravel in root folder and configure database connections and SMTP servers set up API keys (use .env.example as a skeleton) use the above database table.
- Edit /config/*.php files to configure any needed configurations required eg. Locales, etc
- Set permissions so webserver can write to storage, bootstrap/cache
sudo chgrp www-data:www-data -R /var/www/html/laravel
- Setting up file storage for avatars etc. Create dir:
mkdir /var/www/html/opc/laravel/storage/app/dir
Add files to dir:touch /var/www/html/opc/laravel/storage/app/dir/newFile.txt
ln -s /var/www/html/opc/laravel/storage/app/dir /var/www/html/opc/laravel/public/dir
File can then be accessed at:http://localhost:8080/dir/newFile.txt
- Install all dependencies using composer in the root dir:
composer install
- Regenerate the Laravel key to secure sessions and encrypted data via:
php artisan key:generate
- Once database is created create the Database Schema:
php artisan migrate
- Optionally: Seed the database with test values values are found in /database/seeders and /database/modelfactory
php artisan db:seed
Login with: [email protected]:123456 - Optionally: Run phpunit tests on website to check all features are working correctly, this requires seed data.
phpunit
- Navigate to your website you should see the SCKid welcome page at 127.0.0.1, if this fails read the common issues below or review the laravel setup instructions. If issues perist try using the homestead virtual machine
- Set up API access using JWT https://github.com/tymondesigns/jwt-auth/wiki/Installation
php artisan jwt:generate
- Make sure all paths are correct
composer dump-autoload
Root Directory (Example): /Users/pippo/Desktop/OPCCloud/
-
Install your webserver, PHP, MySQL and Composer for PHP dependencies
-
ENter into the root directory:
cd /Users/pippo/Desktop/OPCCloud
-
Git Clone:
https://github.com/cecil0610/SCKidWeb.git
-
Set up Apache root to point to /Users/pippo/Desktop/OPCCloud/SCKidWeb/laravel/
-
Create MySQL database table (e.g. by using 'phpmyadmin')
-
Run this in your terminal to get the latest Composer version
1). php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" 2). php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" 3). php composer-setup.php 4). php -r "unlink('composer-setup.php');"
-
Move composer:
mv composer.phar /usr/local/bin/composer
-
Install all dependencies using composer in the root dir:
composer install
-
Edit or create a .env file:
cp .env.example .env
-
Change local database name, username and password:
nano .env
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead (note: your own database name) DB_USERNAME=root DB_PASSWORD=xxxx
-
Regenerate the Laravel key to secure sessions and encrypted data via::
php artisan key:generate
-
Once database is connected, create the Database Schema:
php artisan migrate
-
Modify httpd.conf:
sudo nano /etc/apache2/httpd.conf
1). Change DocumentRoot "/Library/WebServer/Documents" to your user directory; 2). Change the <Directory> tag reference right below the DocumentRoot line. This should also be changed to point to your new document root; 3). In that same <Directory> block you will find an AllowOverride setting, this should be changed to: AllowOverride All; 4). Change the value of "User&Group" for access permision. 5). Apache restart: sudo apachectl -k restart
-
[Optional] Seed the database with test values
php artisan db:seed
(e.g. Login with: [email protected]:123456) -
[Optional] Make sure all paths are correct
composer dump-autoload
##Troubleshooting:
- .env files not set up correctly, create .env file from the .env.example file
- Webserver root should point to public dir
- Setup permissions of directories if not using homestead VM
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
- Make sure all databases are migrated and seeded
- Clear cache
php artisan cache:clear
##Todo:
- Realtime communication
- Bidrectional Sync complexity
##Security Measures:
- HTTPS access
- JWT for API
- No advertising or risky third party libaries
- No storage of secure information
- BCrypt password hashing
- Policy creation using laravel API
- Blade templating to protect from SQL injection and XSS
##Acknowledgements:
Developers Yuze Liu, Spencer Tang, Ben Edridge
Laravel http://laravel.com/docs
JWT AUTH tymon/jwt-auth (Restful API)
Facebook API https://github.com/facebook/facebook-php-sdk-v4
SB Admin 2 Template http://startbootstrap.com/template-overviews/sb-admin-2/
Welcome Template html5up.net
Socialite for API access https://github.com/laravel/socialite
SocialiteProviders for extra access to(instagram and tumblr) http://socialiteproviders.github.io
Google fonts
Font Awesome