# Local installation

OfficeLife is based on Laravel and requires a combination of PHP and JS packages that are documented here.

If you want to contribute to OfficeLife, or test it locally, you need to execute a few steps to install it properly:

# Pull the project from GitHub

git clone git@github.com:officelifehq/officelife.git

This will clone the repository on your machine.

# Install dependencies

Laravel uses a lot of PHP and JS dependencies. We need to pull all those packages to let OfficeLife use them.

For Javascript, note that we use Yarn ourselves. You can use NPM if you prefer.

Run those two commands:

yarn
composer install

This should take some time depending on your internet connection. yarn specifically, is CPU intensive and could take some time.

# Compile assets

It's important to note that we don't store assets that can be compiled on the repository itself. That means, if you've only pulled the code from GitHub:

  • no CSS is generated by default,
  • the Vue files are not compiled and therefore the app can't be executed,
  • there are no files for the translations, so only English would work.

Therefore, there are a couple of commands to run to compile all those assets.

# Lang files

Most of the time, you won't need to run this command yourself, as it's included when you run either yarn run watch or yarn production (see below). But in case you still need for some reasons to compile only the translations, run

php artisan lang:generate

This will compile the translation files that the project needs to display the different views.

# CSS and Vue files

We need to compile the files that serve the views directly, mainly CSS and JS files.

There are two ways to accomplish this and this depends on your goals.

  1. We can mimic the production by compiling all the assets and compressing them, without generating the .map files that we need to properly debug code when things go wrong.
  2. We can compile assets in development mode, while watching for changes on files. I personally prefer this mode when I develop on OfficeLife.

To achieve the first goal:

yarn run production

To achieve the second goal:

yarn run watch

It's really up to you to decide what to do. Keep in mind that if you run the first command, you will have to run it every time you change something in the code - which might be painful.

# The .env file

OfficeLife needs some default values to run properly. Those values are located in the .env file.

By default, the project doesn't come with a .env file, but we provide a default file that needs to be copied to help you with this.

So first, we need to copy the default .env file, then edit the .env file to your likings.

cp .env.example .env

Then, edit the .env file with your editor of choice and provide the right information.

The project should be up and running.