Code Monkey home page Code Monkey logo

Terablaze

Terablaze is a PHP MVC framework for developing web applications. It is an open source framework released under MIT License.

Installation, Configuration and Running

Requirements

  1. Web server
  2. PHP
  3. MySQL (optional)
  4. Composer

Installation.

1. Via Composer (recommended)

Navigate to the desired web-accessible folder on your server and run the following command from the command line.

composer create-project terablaze/terablaze ./

to install in the current folder or

composer create-project terablaze/terablaze project-folder

to install in the 'project-folder'

Configuration

First, create a .env file using the .ent.template file as a guide

Though the default Terablaze configuration settings is enough to get you started, it is advisable and in some cases compulsory to go through the config directory and configure accordingly.

Running

Navigate to your project's root folder via the command line and run

php -S localhost:8000

visit http://localhost:8000 in your browser.

If you are not using the build in PHP server, visit your installation folder in your browser through your server (could be a live domain, remote ip or localhost if you are running on a local machine).

If you see the Terablaze welcome page without errors, then your installation is successful.

The controller to the welcome page is src/App/Controller/WelcomeController.php and the view file is src/App/views/welcome.php

Using

Controllers

Create your controllers in the src/App/Controller folder (You can use any directory as long as the Controller namespace/class matches the directory/file path).

Your controller class should extend the base controller \Terablaze\Controller\Controller to have access to some nice features the base controller offers

Models

Create your models in the src/App/Model folder (You can use any directory as long as the Model namespace/class matches the directory/file path).

Your model class should extend the base model\Terablaze\Ripana\ORM\Model

Views

Create your views in the src/App/views folder.

To load your view files, simply use

$viewContent = $this->renderView('App::view_file_with_or_without_extension') or return $this->render('App::view_file_with_or_without_extension'); to return a response instance with loaded view as content body

Pass an optional second argument which is an array and is extracted internally and therefore available in the view as variables.

For instance:

$data = [
    'name' = 'Terablaze',
    'type' = 'MVC Framework',
    'language' = 'PHP'
];

$this->renderView('App::home', $data);

The code above will make the variables $name, $type and $language available in the src/App/views/home.php view file

To load a view from within another view, use $this->includeView('App::included_view_file'), this allows the included view have access to the variables extracted in the parent view

Stability status

It is very important to note that this framework is currently very unstable and may change frequently for now. As much as we use it in several live projects(from really simple projects to very big and complex projects), we do not advise you to use in a production environment unless you are sure of what you're doing and you're willing to invest the time.

Contributing

Simply fork the project and make pull requests. Try to go through the code to not deviate too much from our code style.

If you are interested in joining the development team, simply mail [email protected]

Note that the email used here will likely change soon.

terablaze's Projects

core icon core

Terablaze framework core

psr7 icon psr7

A super lightweight PSR-7 implementation

psr7-server icon psr7-server

Helper classes to use any PSR7 implementation as your main request and response

router icon router

Extremely fast and flexible PSR-7 and PSR-15 based HTTP router

serializable-closure icon serializable-closure

TeraBlaze Serializable Closure provides an easy and secure way to serialize closures in 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.