PHPackages                             elephfront/application - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. elephfront/application

ActiveProject[Framework](/categories/framework)

elephfront/application
======================

Elephfront application skeleton

1.0.0(8y ago)03MITPHP

Since Aug 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/elephfront/application)[ Packagist](https://packagist.org/packages/elephfront/application)[ RSS](/packages/elephfront-application/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

Elephfront application skeleton
===============================

[](#elephfront-application-skeleton)

**This repository is under development.**

Elephfront is an open-source PHP front-end stack for templates creation.

This repository is an application skeleton based on the Elephfront tools. You can use it to quickly kickstart your new templates creation project.
This application skeleton will manage for you your SASS assets compilation, your CSS minification, your JS inclusion, your JS minification and comes bundled with a Live Reload server that will really ease your templates developments.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1.0
- The [Robo task runner](https://github.com/consolidation/Robo)
- The [absalomedia/sassphp](https://github.com/absalomedia/sassphp) PHP extension. (See [this section](https://github.com/elephfront/robo-sass#installing-the-extension) of the [robo-sass task](https://github.com/elephfront/robo-sass) to learn how to install it.)

Installation
------------

[](#installation)

You can create a new elephfront project using [composer](http://getcomposer.org):

```
composer create-project elephfront/application my-template-project

```

Starting the server
-------------------

[](#starting-the-server)

The main feature of the package is to provide a command that will start a PHP server to serve your pages.
It also will start a Live Reload server in the background to automatically refresh your browser when you make changes to one your assets file (as there is a watcher for changes in SASS files, JS files and pages / system files).

Once installed, you can use the following command to start both servers :

```
vendor/bin/robo serve

```

This will start a new server under the `http://localhost:9876/` URL and launch your default browser to this URL.
From now on, every change you make in your assets files will trigger a "compilation" on those files and automatically refresh your browser in order to ease your development process.

Directory structure
-------------------

[](#directory-structure)

By default, the project contains a **src** directory. This is where you put all your raw assets.
The expected structure is the following :

```
src/
  assets/
    css/
    js/
  pages/
  system/

```

### assets/css

[](#assetscss)

The **assets/css** folder is where you put your SASS files.
By default a **main.scss** file is expected and will be compiled and minified.

### assets/js

[](#assetsjs)

The **assets/js** folder is where you put your JS files.
By default a **main.js** file is expected and will be compiled and minified.

### pages

[](#pages)

The **pages** folder is where you put the various templates you want to created. The files are expected to be **.php** files. The inner structure is left to you. Just be aware that if you create an **index.php** file, it will fetched by default by the router if you try to reach a sub-directory. You can use everything you would do in PHP in those files (like `include`, `require`, functions, etc.), they will be interpreted by a PHP server.

### system

[](#system)

This folder is internal to Elephfront and contains the router used by the internal PHP server launched by the `serve` command and the error page if the page you try to reach does not exist when the server is launched. This is also were the **robo-live-reload** will put its JS file to make the browser listens for messages from the Web Socket server.
In most cases, you will never need to touch the files in this directory.

Configuration
-------------

[](#configuration)

### Compilation tasks

[](#compilation-tasks)

By default, the compilations tasks only process a `main.scss` and a `main.js` file.
If you wish to have the CSS compilation task or the JS compilation task to manage more files, you can add them by creating and using the **elephfront-config.php** configuration file at the root of the project.

This file is expected to return a single array. Its structure should be the same as the one from the `loadDefaultConfig()` method in the **RoboFile.php** file.
Let's say you have the following directory and file structure:

```
src/
  assets/
    css/
      home/
        slider.scss
      main.scss
      home.scss // contains an `include('home/slider.scss')`
    js/
  pages/
  system/

```

You could have the following **elephfront-config.php** file:

```
