Giter Club home page Giter Club logo

b8framework's Introduction

b8 Framework

Build Status

b8 framework is a lightweight, simple framework for high-throughput PHP applications. It does not enforce a specific type of application, nor particularly an application structure, it simply helps you to build things.

We've used the framework to build web sites, APIs, and web applications, each handling tens of millions of requests a month.

b8framework's People

Contributors

dancryer avatar georgegardiner avatar jfi avatar kamermans avatar temporaryjam 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

b8framework's Issues

Extend validation

Missing func.:
Email validation
isUnique - check db if value exists

There is no way to get the current connected database host

Currently, the framework does not record the host that the database connection is established to:

https://github.com/Block8/b8framework/blob/master/b8/Database.php#L126

and as a result, you cannot retrieve this information later. PHPCI, for example, needs to know which host it is connected to in order to pass that information to the MySQL plugin. This is also causing PHPCI itself to fail, since PHPCI_DB_HOST is no longer defined:

https://github.com/Block8/PHPCI/blob/c1bf4ab6364e2b8a9ef3d9dc52396076688952fc/PHPCI/Plugin/Mysql.php#L46

The challenge is that the read and write servers may be different, so you would need to store these hosts separately or find a way to extract it from PDO itself. I imagine PDO also does not store this information since it does not make sense in the case of UNIX sockets, SQLite, etc.

Database connexion impossible

Because "b8" missing when calling database's params :
In block8/b8framework/b8/Database.php, l.54 you have :
$settings = $config->get('database', array());

And $settings = $config->get('b8.database', array()); should be search according your last installCommand which write $conf['b8']['database']...

Exceptions cleanup

  • Create new generic exception types.
  • Update code generation to throw generic exceptions in models and stores.
  • Update code generation to catch generic exceptions and throw HttpExceptions in controllers.

Can't resolve controllers when '?' is present in the URL on nginx

This is an issue affecting usage of PHPCI, using the recommended virtual host settings for nginx, but the bug is in b8framework code so I thought I'd post the issue here.

When a URL contains a question mark on nginx, the method b8\Http\Request::getRequestPath strips the entire request path, meaning the framework can't resolve the URL to a controller. The issue appears to be with how the SCRIPT_NAME is stripped from the path:

        if ($_SERVER['SCRIPT_NAME'] != $_SERVER['REQUEST_URI']) {
            $scriptPath = str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']);
            $path = str_replace($scriptPath, '', $path);
        }

On nginx, the values for these parameters would look something like the following:

  ["SCRIPT_NAME"]=>
  string(25) "/settings/github_callback"
  ["REQUEST_URI"]=>
  string(51) "/settings/github_callback?code=etc"

When the framework strips the SCRIPT_NAME it strips everything but the query string.

Need documentation

Thank you for good job, but can you add more instructions to wiki, for example, how to start with framework

Generator fails on reserved MySQL keywords as table names

e.g. with a table 'case':

$ php Generate.php 
PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'case' at line 1' in /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php:52
Stack trace:
#0 /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php(52): PDO->query('SHOW CREATE TAB...')
#1 /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php(27): b8\Database\Map->_getRelationships()
#2 /var/www/site.dev/vendor/block8/b8framework/b8/Database/CodeGenerator.php(22): b8\Database\Map->generate()
#3 /var/www/site.dev/Generate.php(4): b8\Database\CodeGenerator->__construct(Object(b8\Database), 'site', '/var/www/site....', true)
#4 {main}
  thrown in /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php on line 52

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'case' at line 1' in /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php on line 52

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'case' at line 1 in /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php on line 52

Call Stack:
    0.0005     223944   1. {main}() /var/www/site.dev/Generate.php:0
    0.0208     422360   2. b8\Database\CodeGenerator->__construct() /var/www/site.dev/Generate.php:4
    0.0239     488320   3. b8\Database\Map->generate() /var/www/site.dev/vendor/block8/b8framework/b8/Database/CodeGenerator.php:22
    0.0242     501600   4. b8\Database\Map->_getRelationships() /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php:27
    0.0243     501816   5. PDO->query() /var/www/site.dev/vendor/block8/b8framework/b8/Database/Map.php:52

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.