Giter Club home page Giter Club logo

tinyphp's Introduction

๐Ÿš€ Tiny PHP

Scrutinizer Quality Score Scrutinizer Build Status

Tiny PHP is a simple PHP Framework to create static websites using PHP.

Tiny PHP uses of Laravel Blade Templating Engine to render static Content.

Understanding Tiny PHP

๐Ÿ“ Folder Structure

  • controllers

    • Controller.php
  • public

    • css
    • js
  • views

    • errors

    In controllers folder there is Controller.php File which handles rendering of Page Cotent through Blade Engine.

    public is the root directory of the framework which contains index.php file which loads the libraries and based on the URL renders the Blade file content. You may include CSS and JS files in this folder and load those in your view file.

    views is the folder where you may include your different Blade views saved with extension .blade.php. I have included about.blade.php, index.blade.php and template.blade.php. template.blade.php is the master file which loads the Stylesheet and Javascript files. about.blade.php and index.blade.ph are the child pages which extends the master template.blade.php

    In errors folder you may include your Error files, right now I have added 404.blade.php which gets loaded for invalid request.

    ๐Ÿ˜• How to get started?

    Just clone the repository of download it from here

    then execute

    composer install
    

    to download all the necessary libraries for blade templating to work.

    That's it!

    Now just host the website, you may use php's build in server for that, just execute cd public and then execute php -S localhost:8000 and you can check the URL http://localhost:8000/ in browser.

    ๐Ÿ˜Ÿ How to add more Pages?

    Right now only home and about pages are there in the framework, if you want to add more pages you can do that by simply adding the methods in controllers/Controller.php. The method name will be dependent on the URL.

    Eg. If you want contact URL to be active then you can add following method in Controller.php

    public function contact()
    {
      return $this->renderer->render('contact', []);
    }
    

    along with the method you will need to add contact.blade.php file in views folder, after that you will be able to visit http://localhost:8000/contact page untill then it will render errors/404.blade.php file.

    If you want to add localhost:8000/about/me then you will have to add method with name about_me in Controller.php.

    If you want to add localhost:8000/about/me/profile then you will have to add method with name about_me_profile in Controller.php and so on.

๐Ÿ”ง Customizing

If you want to customize the directory names and file names, you can achieve that by simply using the .env file. Just rename the .env.example to .env and you can alter the default variables you can add more variables and customize it the way you want...

๐Ÿ’ Credits

Windwalker Renderer

illuminate/view

Bootstrap

Thank you!!!

tinyphp's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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