Giter Club home page Giter Club logo

assegai's People

Contributors

etenil avatar lferro9000 avatar skotur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

assegai's Issues

Add generic views

Add generic views support for (almost) static templates, redirections, 404s etc.

Parse php://input automatically

On non-POST requests, one can still submit POST-like data (with content-type application/x-www-encoded). Parse php://input automatically and load as POST. Very useful for REST requests.

Reformat assegai to PSR2 standard

So it has come to this. More and more projects and companies adhere to the PSR standards, including the code formatting guidelines. So let's fit in and do the same.

Add logging facility

The framework provides no way to log what is happening.

Bundle Monolog with Assegai and hook it up in the right places of the framework.

Move views to objects

Currently views are not objects but sort of hacks on the controller that exploit closures. Change this to use proper view objects.

Sessions are awkward

Sessions must be accessed through a response object, which could be implied.

Make sessions either part of Server or an object of their own.

case-insensitive

Allow case-insensitive filename for controlers and models.

As example you have an app "admin" and inside controlers create "Index.php" with name of controler "Admin_Controller_Index" gets a Server error until you rename your file to "index.php"

Switch config files to JSON format

Currently, conf files are all in PHP. That's great for ease of implementation, however it also means that the configuration files cannot easily be generated (PHP isn't readily parsable by computers).

Several other formats would provide an equally (or better) readability while being readily consumable by computers. The main contenders being INI, Yaml and JSON.

  • Ini is limited and cannot contain complex multi-level data structures. So not usable here.
  • Yaml is very readable and manipulable, however it requires external dependencies to work.
  • JSON is bundled with PHP and just a bit less readable than Yaml. It's a very widely used format however so most devs should be comfortable with it. Additionally, it's already used in composer.json.

Handle ownership in ACL

The ACL module only handles access based on role and resource. It also needs to be able to account for ownership.

Make applications self-contained

Make applications pluggable by letting them have the following:

  • Their own modules
  • Their own composer.json-based dependencies.

Standardise some DAO model

Standardise, document and write interfaces for some form DAO model that will be used by optional utilities. Make this very optional! We want people to continue to write model the way they like.

callback() in the validator isn't working with closures

When using a closure in the validator, nothing happens.

Example:

$validator = new \assegai\modules\Validator(['mydate' => '1283123');
$validator
    ->required('You must enter a lesson date')
    ->callback(function($value) { return preg_match('%^\d{4}-\d{2}-\d{2}$%', $value); }, 'Date format not recognised.')
    ->validate('mydate');

Issue with html function in Security

\assegai\Security.php line 97
htmlentities() returns an empty string if it fails to convert anything. Can we add an option (or just make it automatic) to set ENT_SUBSTITUTE so that it replaces these errors with a generic replacement character instead of throwing the whole variable away?

Default GET/POST parameters are mangled

These two functions will, if the GET or POST parameter doesn't exist, pass the $default value through htmlentities() instead of just returning it, which is counterintuitive and not what the doc-comment says.

    /**
     * Returns an escaped post variable or default.
     * @param string $varname is the variable's name.
     * @param mixed  $default is the default to be returned if the variable
     * doesn't exist.
     */
    function post($varname, $default = false)
    {
        return $this->sec->clean($this->unsafePost($varname, $default));
    }

    /**
     * Returns an escaped get variable or default.
     * @param string $varname is the variable's name.
     * @param mixed  $default is the default to be returned if the variable
     * doesn't exist.
     */
    function get($varname, $default = false)
    {
        return $this->sec->clean($this->unsafeGet($varname, $default));
    }

I'm not sure how you want to structure the code to avoid that, otherwise I'd submit a patch.

Scope issue in \assegai\config

The code is called in a static scope to a non-static class property:

public static function fromFile($path)
 {
    if(!file_exists($path)) {
        throw new Exception("File `$path' doesn't exist.");
    }

    $conf = array();
    require($path);

    $this->settings = $conf;
 }

Cookies are awkward

As for sessions, cookies need to be either within Server or to have their own object.

Prefix is not working anymore, and not documented.

While most of the infrastructure to set a URL prefix is still present in code, setting it currently has no effect; the route returned by the request remains unchanged.

Add support to prefix routes in the Request object so that it works like so:

http://blog.com/foo/bar/stuff + /foo/bar/ => /stuff
http://blog.com/foo/bar + /foo/bar/ => /

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.