Skip to content

scify/game-travelers-laravel

Repository files navigation

Taxidiotes Game Web Application

JavaScript Style Guide: Good Parts contributions welcome License Maintenance Ask Me Anything !

Laravel 9 Web Application for the Taksidiotes Game Web app

Project URL

Installation Instructions:

Pre-initialization steps

After cloning the project, create an .env file (should be a copy of .env.example), containing the information about your database name and credentials:

cp .env.example .env

Take a look at the .env file that was created. You may need to update the DB_* variables, in order to set up the DB connection. Also, make sure that the APP_URL is set to the correct domain and port that you will be using.


First time install (setup database and install dependencies)

  1. Make sure php 8.0 (or newer) is installed.

  2. After cloning the project, create an .env file (should be a copy of .env.example), containing the information about your database name and credentials. Then run php artisan migrate to create the DB schema and php artisan db:seed in order to insert the starter data to the DB

  3. Install laravel/back-end dependencies

composer install
  1. Front-end dependencies

If you are using nvm, run this command in order to sync to the correct NodeJS version for the project:

nvm use

Then, install and compile the front-end dependencies:

npm install

npm run dev
  1. Create the symbolic link for user-uploaded files.
php artisan storage:link

in order to link the /public/storage folder with the /storage/app/public directory.

SEO - Generate Sitemap

This application uses Spatie - Laravel Sitemap plugin, in order to create the public/sitemap.xml file (which is excluded from git), that will be crawled by the search engines. In order to run the generator for the current application installation, run the embedded Laravel command:

php artisan sitemap:generate

PHP code style - Laravel Pint

This application uses Laravel Pint in order to perform code-style.

In order to run the styler, run :

./vendor/bin/pint --test -v # the --test will not do any changes, it will just output the changes needed

./vendor/bin/pint -v # this command will actually perform the code style changes 

Apache configuration example:

% sudo touch /etc/apache2/sites-available/taxidiotes.conf
% sudo nano /etc/apache2/sites-available/taxidiotes.conf
<VirtualHost *:80>
       
        ServerName dev.taxidiotes
        ServerAlias dev.taxidiotes
        DocumentRoot "/home/path/to/project/public"
        <Directory "/home/path/to/project/public">
            Require all granted
            AllowOverride all
        </Directory>
       
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Make the symbolic link:

% cd /etc/apache2/sites-enabled && sudo ln -s ../sites-available/taxidiotes.conf

Enable mod_rewrite, mod_ssl and restart apache:

% sudo a2enmod rewrite && sudo a2enmod ssl && sudo service apache2 restart

Fix permissions for storage directory:

sudo chown -R ${USER}:www-data storage

sudo chmod 775 storage

cd storage/

sudo find . -type f -exec chmod 664 {} \;

sudo find . -type d -exec chmod 775 {} \;

Or run the set-file-permissions.sh script (needs sudo):

sudo ./set-file-permissions.sh www-data ${USER} .

Change hosts file so dev.taxidiotes points to localhost:

sudo nano /etc/hosts
127.0.0.1       dev.taxidiotes

About the music files

The directories under resources/audio/fx and resources/audio/music should contain audio (.mp3) files that are not checked in source control, because of copyright issues.

Please check resources/audio/fx/README.md and resources/audio/music/README.md , in order to see which files you should download and put there.

In order to upload the files in a remote environment (staging or production server, for example), you can use scp:

scp -r -P 1337 /path/to/local/fx/* project_taxidiotes@server:/home/project_taxidiotes/www/resources/audio/fx

scp -r -P 1337 /path/to/local/music/* project_taxidiotes@server:/home/project_taxidiotes/www/resources/audio/music

How to debug

  • Install and configure Xdebug on your machine
  • At Chrome install Xdebug helper
  • At PhpStorm/IntelliJ click the "Start listening for PHP debug connections"

How to contribute

  • Send us a pull request describing your improvements/fixes/features