Giter Club home page Giter Club logo

lightning's Introduction

Lightning

A lite yet simple PHP framework. Using an intelligent package based dependencies system, Lightning load only the files you really need.

Write code as faster as your website run

Getting Started

Hello World Tutorial

First of all to understand the basis of Lightning logic you have to understand the MVC design pattern. Lightning kind of fork this pattern to make his very own. The architecture is as it follow:

  • Modules
  • Bundles
  • Views

So what are the differences between this and a classic MVC pattern. The Modules are optional, there are kind of plugins that add functions and tools to your website to make the framework yours. The Bundles are a mix of what we call Controllers and Models. So basically all the query to the database and the modification of the results occurs in them.

So now that we know that let's dive into it.


Configure the framework

First of all you have to configure the Framework. You will find in the Core folder a file named Configuration.php. This file contains all the essentials informations the framework needs to run correctly.

$base_dir is the root adress of your website, it will be used to handle routes correctly

$default_method_call is the name of your default action. If none specified in the address bar the framework will launch this one by default.

$index_bundle is the name of your site default bundle. The root of your website. For the tutorial we gonna set it to Home.

Now that the framework is correctly configured you're ready to go!


Create your first bundle

Now you have to create your homepage bundle. So go to the Bundles folder and create a new file called Home.php in it. Bundles follow strict naming rules, you have to name it with the first letter in capital and the other ones in lower case. And it have of course, to be named as the class name.

So now create your Home class and make it extends Bundle so you can get something like this:

<?php

class Home extends Bundle
{

}

And now we gonna add the default method name you configured, by default it's named index. And in this method we gonna say Hello to the World. Let's see what it's doing.

<?php

class Home extends Bundle
{
	public function index()
	{
		echo "Hello World!";
	}
}

And that's all you need! Now go to your website you should see your printed Hello World!

More tutorials to come!

More infos

http://www.bukkit.fr/index.php/topic/14366-lightning-un-framework-l%C3%A9ger-et-facile/

Download the latest release

https://github.com/abclive/Lightning/releases

lightning's People

Contributors

abclive avatar abclivefr avatar

Watchers

 avatar  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.