Snake web application
Project of the web application where you can interact via API with Snake game which is available to download on it.
- Application is made in PHP with Laravel in 8.x version.
- Project uses a login system from the Breeze starter kit which has been modified.
- Application is responsive, made with the Bootstrap 5.
- To display tables is used the DataTables plugin.
- jQuery is used to write JavaScript things.
- Logged user can set an avatar, change an email, change a password etc. in a user panel.
- Users can compare each other in a ranking page what means players can compete what gives a lot of fun!
- Admin is able to use well expanded admin panel which provides a lot of functionalities.
- Snake mini-game which is available to play on welcome page is made in clear JavaScript.
- In application has been implemented PWA system, what means app can run in a offline mode (without an internet connection - caches things while first visit).
Installation
To successfully install and test application you need to have installed composer, npm, PHP with version >= 7.3 and database environment (for example XAMPP - localhost).
Open folder where you want to have project files, open console and then clone the repository
git clone https://github.com/maciekiwaniuk/snake-web-app
Change folder in console to created folder with project files
cd snake-web-app
Install all the dependencies using composer
composer install
Run npm install command
npm install
Run npm run dev command to compile js files
npm run dev
Copy the example env file and make the required configuration changes in the .env file
copy .env.example .env
Generate a new application key
php artisan key:generate
Create the symbolic link between storage and public folders
php artisan storage:link
Run the database migrations (Set the database connection in .env before migrating)
php artisan migrate
Start the local development server
php artisan serve
You can now access the server at http://localhost:8000 or http://127.0.0.1:8000
To fill database with data use db:seed command which will create users accounts with randomly generated game data etc.
php artisan db:seed
Captcha validation
To enable captcha validation you need to set public and private keys in .env file and set CAPTCHA_VALIDATION_ENABLED to true
CAPTCHA_VALIDATION_ENABLED=true
E-mail service
To enable e-mail service and send e-mails properly you need to fill all necessary variables related with prefix MAIL_ in .env and after that set MAIL_SERVICE_ENABLED to true
MAIL_SERVICE_ENABLED=true
You have to also run queue:work command to set up queue system
php artisan queue:work
Redis service
Redis is necessary for example to count total visits on the application. To enable redis service you need to fill all crucial variables related with prefix REDIS_ in .env and after that set REDIS_CONFIGURED to true
REDIS_CONFIGURED=true
PWA cache service
In case of any problems with PWA caching, you can easily disable PWA caching system via set PWA_SERVICE_WORKER_ENABLED to false in .env file
PWA_SERVICE_WORKER_ENABLED=false
Testing
To test if application is running properly, you can use implemented tests
php artisan test
Application usage
Every account generated by db:seed command has same password except one with administrative permissions
password: test1234
To log into account with administrative permissions use
email: [email protected]
password: admin1234
To log into account with normal permissions use
email: [email protected]
password: test1234