Giter Club home page Giter Club logo

flight-skeleton's Introduction

Flight Skeleton

This skeleton provides a quick start for the development of an application with the Flight PHP microframework. The goal here is to get going as fast as possible.

It also adds support for Sass, Twig, 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, 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

Flight::route("/", ["\Acme\Demo\Controller\Demo", "index"]);

An example API router has been created in src/Acme/Demo/Controller/API.php where Flight::json is used to send the response back.

Controllers

Place your code in the src folder. All classes from here are autoloaded by their namespace. For an example, have a look in the demo code in src/Acme/demo/Controller/Demo.php. As you can see, the controller uses the namespace Acme\Demo\Controller.

Templates

Twig templates are loaded by default from app/resouces/views/. You can change this by editing the path in app/config/config.php.

Logging

Your application logs into var/logs. Should you want to, you can add more loggers in app/config/logger_handlers.php, or completely reconfigure it in app/logger.php.

You can then at any time log messages, for example:

$logger->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.

Volta

This project uses Volta 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 license.

flight-skeleton's People

Contributors

daniel-melzer avatar dependabot[bot] avatar markhughes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jniltinho

flight-skeleton's Issues

I can't change name of class

Hi i have got some problems ,when i tried to change name of class in Demo.php it's stop working. Pls help me!! (to be honest when i change name of class in Demo.php i also changed the path in routes.php)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.