All Projects → pricop → fir

pricop / fir

Licence: MIT license
Fir. A lightweight PHP MVC Framework.

Programming Languages

PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to fir

OwOFrame
A lightweight MVC framework for PHP
Stars: ✭ 46 (+39.39%)
Mutual labels:  mvc, php-framework
Bingo-Framework
MVC framework for PHP
Stars: ✭ 15 (-54.55%)
Mutual labels:  mvc, php-framework
W
Framework pédagogique de la WebForce3
Stars: ✭ 10 (-69.7%)
Mutual labels:  mvc, php-framework
velox
The minimal PHP micro-framework.
Stars: ✭ 55 (+66.67%)
Mutual labels:  mvc, php-framework
Imi
imi 是基于 Swoole 的 PHP 协程开发框架,它支持 Http、Http2、WebSocket、TCP、UDP、MQTT 等主流协议的服务开发,特别适合互联网微服务、即时通讯聊天im、物联网等场景!。QQ群:17916227
Stars: ✭ 680 (+1960.61%)
Mutual labels:  mvc, php-framework
Lightweight-PHP-Framework-For-Web-and-APIs
Simple PHP framework that helps you quickly understand and write simple APIs.
Stars: ✭ 24 (-27.27%)
Mutual labels:  mvc, php-framework
startmvc
超轻量php框架 lightweight php framework
Stars: ✭ 25 (-24.24%)
Mutual labels:  mvc, php-framework
Polyel-Framework
⚡️ Voltis Core: A PHP framework based on Swoole from the ground up
Stars: ✭ 22 (-33.33%)
Mutual labels:  mvc, php-framework
Koseven
Koseven a Kohana fork compatible with PHP7
Stars: ✭ 332 (+906.06%)
Mutual labels:  mvc, php-framework
miniPHP
A small, simple PHP MVC framework skeleton that encapsulates a lot of features surrounded with powerful security layers.
Stars: ✭ 147 (+345.45%)
Mutual labels:  mvc, php-framework
leafMVC
MVC "Framework" created from Leaf PHP Framework
Stars: ✭ 25 (-24.24%)
Mutual labels:  mvc, php-framework
Php Msf
PHP微服务框架即Micro Service Framework For PHP
Stars: ✭ 1,764 (+5245.45%)
Mutual labels:  mvc, php-framework
PHPFlask
🍶 Flask for PHP
Stars: ✭ 15 (-54.55%)
Mutual labels:  mvc, php-framework
Miniphp
A small, simple PHP MVC framework skeleton that encapsulates a lot of features surrounded with powerful security layers.
Stars: ✭ 144 (+336.36%)
Mutual labels:  mvc, php-framework
Leaf
🍁 The easiest way to create clean, simple but powerful web apps and APIs quickly
Stars: ✭ 248 (+651.52%)
Mutual labels:  mvc, php-framework
Cfwheels
An open source ColdFusion framework inspired by Ruby on Rails.
Stars: ✭ 188 (+469.7%)
Mutual labels:  mvc
Coldbox Platform
A modern, fluent and conventions based HMVC framework for ColdFusion (CFML)
Stars: ✭ 220 (+566.67%)
Mutual labels:  mvc
Elefant
Elefant, the refreshingly simple PHP CMS and web framework.
Stars: ✭ 188 (+469.7%)
Mutual labels:  mvc
Smartstorenet
Open Source ASP.NET MVC Enterprise eCommerce Shopping Cart Solution
Stars: ✭ 2,363 (+7060.61%)
Mutual labels:  mvc
Opentouryo
”Open棟梁”は、長年の.NETアプリケーション開発実績にて蓄積したノウハウに基づき開発した.NET用アプリケーション フレームワークです。 (”OpenTouryo” , is an application framework for .NET which was developed using the accumulated know-how with a long track record in .NET application development.)
Stars: ✭ 233 (+606.06%)
Mutual labels:  mvc

GitHub issues

Fir Framework

Fir

Fir. A lightweight PHP MVC Framework.

The Fir framework started as micro-framework with the purpose of being used in private projects, with the strongest points being extremly fast and easy to use. Fir is not a replacement for professional frameworks, however if you want to quickly build a prototipe app, make a couple of AJAXed pages and do a couple of database calls, Fir should be a good option.

Made with Fir:

Features

Back-end

  • Extremely fast (3ms exec. time)
  • Extremely lightweight (30kb)
  • MVC pattern
  • Dynamic Routing (with clean URLs)
  • Helpers support (lazy loading)
  • Libraries support (lazy loading)
  • Middlewares support (lazy loading)
  • Composer support (lazy loading)
  • Language system (lazy loading)
  • Fully namespaced
  • PSR-2 coding style
  • CSRF protection for forms

Front-end

  • Dynamic page loading (AJAX)
  • jQuery included
  • Bootstrap included

Documentation

Requirements

Software Modules
PHP >=7 mbstring
Apache >=2 mod_rewrite
MySQL >=5

Installation

  1. Run composer create-project pricop/fir /your-project
  2. Import the fir.sql file into your database.
  3. Open the app/includes/config.php file, and update the values YOURDBUSER, YOURDBNAME, YOURDBPASS, https://localhost/your-project with your own information.

You can now access your website using the URL you defined in APP_PATH.


Controllers

Creating a new controller

  • Controllers can be created in the /app/controllers folder.
  • Controllers should extend the base Controller class, e.g: class Auth extends Controller {}.
  • Each controller must have a public method, called index, e.g: public function index() {}.

Loading a model

  • To load a new model, use the $this->model('Example') method.

Returning a view

  • To return a view, inside your methods you would return ['content' => $this->view->render($data, 'auth/register')], where $data is an array object which contains the data that's passed to the views, while 'auth/register' would be the view's path.

Routing

  • Routes are mapped based on the Controller's name and its public methods, when a public method is missing, it will automatically default to the index method of the controller.

Additional

  • You can access the current URL path inside controllers by using the $this->url property.
  • You can access language strings inside controllers by using the $this->lang property.

Example

namespace Fir\Controllers;

class Auth extends Controller
{
    public function index()
    {
        return ['content' => $this->view->render($data, 'auth/index')];
    }
    
    public function register()
    {
        return ['content' => $this->view->render($data, 'auth/register')];
    }
}

Models

Creating a model

  • Models can be created in the /app/models folder.
  • Models should extend the base Model class, e.g: class Auth extends Model {}.
  • You can access the database object by using the $this->db property.

Example

namespace Fir\Models;

class Auth extends Model
{
    public function get()
    {
        // SQL query here
    }
}

Views

Creating a view

  • Views can be created in the /public/theme/views folder.

Accessing data in views

  • The $data array object holds all the data that's passed from the Controllers.

Additional

  • You can escape strings in views using the e function, e.g: e('Example').
  • You can display messages stored in $_SESSION['message'] using the $this->message() method.
  • You can display a language string in views using the $this->lang('key') method.
  • You can render the csrf token input for your forms using the $this->token() method.
  • To view the full list of available helpers for views, see app/core/View.php.

Example

<?php
defined('FIR') OR exit();
?>

<?= e("Hello World") ?>

Wraping up

While this documentation could be more extensive, the code is well commented and most of the things you need to know can be found straight into the examples provided within the framework.

Happy coding.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].