GithubHelp home page GithubHelp logo

premento / flight-skeleton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flightphp/skeleton

0.0 0.0 0.0 44 KB

This is an example repository of how a more complex Flight project might be setup.

PHP 100.00%

flight-skeleton's Introduction

Flight PHP Skeleton App

Use this skeleton application to quickly setup and start working on a new Flight PHP application. This application uses the latest version of Flight PHP v3.

This skeleton application was built for Composer. You also could download a zip of this repo, downloading a zip of the flightphp/core repo, and manually autoload the files by running require('flight/autoload.php') in your app/config/bootstrap.php file.

Installation

Run this command from the directory in which you want to install your new Flight PHP application. (this will require PHP 7.4 or newer)

composer create-project flightphp/skeleton cool-project-name

Replace cool-project-name with the desired directory name for your new application.

Robust Setup of the Application

This skeleton will come with 2 versions of a starter application. The robust version is a fully structured application meant for projects that you anticipate will be a bigger size. This is setup with object oriented programming in mind so that it is easier to unit test and scale your project with multiple developers (or make it easier on yourself).

The robust version adds an app/ directory where everything has a basic structure. This is how this skeleton is configured by default.

One additional thing you'll need to do is copy the app/config/config_sample.php file to app/config/config.php and update the values to be correct for your environment.

Simple Setup of the Application

This is basically a single file application. The only exception to this is the config file which is still in the app/config/ directory. This is a good starting point for smaller projects or projects that you don't anticipate will grow much.

To use the simple version, you'll need to copy the app/config/config_sample.php file to app/config/config.php. Then you'll need to move the index-simple.php file to the public/ directory and rename it to index.php. You can delete any other controllers, views, or config files (except the config.php file of course).

With the simple setup, there is two very import security steps to be aware of.

  • DO NOT SAVE SENSITIVE CREDENTIALS TO THE index.php FILE.
  • DO NOT COMMIT ANY TYPE OF SENSITIVE CREDENTIALS TO YOUR REPOSITORY.

This is what the config file is for. If you need to save sensitive credentials, save them to the config file and then reference them in the index.php file.

Running the Application

No Dependency Setup

To run the application in development, you can run these commands

cd cool-project-name
composer start

After that, open http://localhost:8000 in your browser.

Note: If you run into an error similar to this Failed to listen on localhost:8000 (reason: Address already in use) then you'll need to change the port that the application is running on. You can do this by editing the composer.json file and changing the port in the scripts.start key.

Docker Setup

You can install Docker and use docker-compose to run the app with docker, so you can run these commands:

cd cool-project-name
docker-compose up -d
# or if a newer version of docker
docker compose up -d

After that, open http://localhost:8000 in your browser.

Vagrant Setup

You can install Vagrant and a provider like VirtualBox and use simple run the following command to bring up an environment with PHP/MariaDB already setup based on n0nag0n/firefly

cd cool-project-name
vagrant up

After that, open http://localhost:8000 in your browser.

Do it!

That's it! Go build something flipping sweet!

flight-skeleton's People

Contributors

n0nag0n avatar eydun avatar vlakoff avatar

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.