Git Product home page Git Product logo

one-php-microframework's Introduction

One PHP MicroFramework

An extremely light-weight and small Restful Micro-Framework MVC for Web 2.0 that doesn't get in your way, based on Symfony and ExpressJS. No Config.

Build Status Latest Stable Version Latest Unstable Version License

📢 I stopped developing new features for OnePHP. If you feel like you have the time, you are welcome to contact me or PR and keep this cool framework up to date.


Simplest usage:

// index.php
require_once('src/OnePHP/one_framework.php');
$app = new \OnePHP\App();

$app->get('/:name',function( $name ) use ( $app ){//Action
  echo "Hello $name";
});
$app->listen();

Install:

1- With Composer or download Master ZIP:

composer create-project julces/oneframework

2- Include one_framework.php in your project and copy the .htaccess file in the Root Folder to use the index.php as your front controller. See file structure here for more info.
3- Run App->listen() after adding some Actions

Why use this tiny Microframework?

One PHP is perfect for you if you need to quickly write small and fast Web 2.0 applications with:
1- Restful Routes
2- Easy and clean (GET, POST, PUT, DELETE...) Requests management
3- Restful Response with HTTP Status Code and custom Headers
4- PHP native Views
5- No dependencies, add extra libraries only when you need it.

Do not use One PHP if:

1- You are building big full stack projects
2- You need big built-in libraries like Doctrine and others

Basic Usage 2: Respond to all Requests (if no other match)

$app->respond( function() use ( $app ){
  return $app->ResponseHTML('<p> This is a response with code 404. </p>', 404);
});

Read the Documentation

Contribute, it's easy!

Found a bug, need directions or just want to say hi ?
Let me know, Fork the project, create an issue or contact me.

Follow @juliomatcom to keep up to date

one-php-microframework's People

Contributors

juliomatcom avatar zemistr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

one-php-microframework's Issues

Wildcards in routes?

Hi there!

I am trying to implement a wildcard in the routes, such as showing in https://auth0.com/docs/quickstart/backend/php (see $router->before('GET', '/secured/.*', function() {...)

Do you think there would be something similar in one-php? Basically what that code is doing is adding a controller before any other to make sure any route in this path requires authentication.

Thanks

Optional parameters

Hi, thank you for your work.

Please implement optional parameters for routes like slim framework.

can’t make $request->getBody(); to work.

First, thank you for this wonderful framework. You save me a lot of time with this! 😊

But I have small problem, I can’t make $request->getBody(); to work. I need to get some JSON data but each time, I get this error :

Fatal error: Call to a member function getBody() on null

I have to manually get the data each time like this:

$data = file_get_contents("php://input");

Could you help me with this?

Thank you very much!
Kind regards,

George.

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.