An open API service indexing awesome lists of open source software.

https://github.com/markhughes/flight-skeleton

🐘 A basic PHP 8 project skeleton with Sass, Twig or Latte, Webpack, and FlightPHP
https://github.com/markhughes/flight-skeleton

composer flight-php flightphp latte monolog php php8 sass skeleton-application twig typescript webpack

Last synced: about 1 month ago
JSON representation

🐘 A basic PHP 8 project skeleton with Sass, Twig or Latte, Webpack, and FlightPHP

Awesome Lists containing this project

README

          

# Flight Skeleton

This skeleton provides a quick start for the development of an application with the [Flight](http://flightphp.com) PHP microframework. The
goal here is to get going as fast as possible.

It also adds support for Runway (CLI), Sass, Twig or Latte, and even TypeScript (it also includes Volta for npm version managing)!

## Downloading the skeleton

First, check that you have installed and configured a web server (such as Nginx) with PHP 8 or higher.

You can either use this [template on github](https://github.com/markhughes/flight-skeleton/generate), or use git to clone this repo:

`$ git clone https://github.com/markhughes/flight-skeleton.git my-app-name`

## Creating the application

If you want to define global constants or other settings, you can use the `config.php` in `app/config/`.

### Routing

To define your routes, use the file `app/config/routes.php`:

```php
info('hello world!');
```

### Webpack

Compile your scripts using `npm run build` which will throw it all together in `public/dist/main.js` - check the webpack docs on how to use it more effectively. Your entrypoint is located in `app/resources/scripts/index.ts` if you don't want to use TypeScript just rename index.ts to index.js.

You can also run `npm run dev` to start webpack in watch mode, great for development.

### Commands

Using Runway you can add commands into the application.

```
./runway example:example-command
```

Will execute the command in src/Acme/Demo/Comands/ExampleCommand.php

Runway has a few strict restrictions for commands:

1. They must be in a directory called "commands"
2. The file name must end in Command.php

## Volta

This project uses [Volta](https://volta.sh/) to manage the node and npm version, it is optional to setup but it is a great tool to manage your JavaScript toolchain.

# License

The skeleton is licensed under the [MIT](https://opensource.org/licenses/MIT) license.