GithubHelp home page GithubHelp logo

aleph's Introduction

Aleph

![Gitter](https://badges.gitter.im/Join Chat.svg)

Total Downloads Latest Stable Version Latest Unstable Version License

Aleph is a very simple PHP framework for very small sites.

Installation

Install via composer:

$ composer require lastguest/aleph -o

Or download only the framework file

Or remote include the framework file: (needs allow_url_include = true in php.ini)

<?php
include "https://raw.githubusercontent.com/lastguest/aleph/master/src/aleph.php";

Documentation

URL Routing

<?php
include "aleph.php";

get('/',function(){
  echo "<h1>Hello!</h1>";
});

// If you return an array or an object it will served as JSON 
get('/api/todos',function(){
  return [
    [ "id"=>1, "text"=>"Write documentation" ],
    [ "id"=>2, "text"=>"Smile" ],
    [ "id"=>3, "text"=>"Play more games" ],
    [ "id"=>4, "text"=>"Conquer the World" ],
  ];
});

Database

Init database DSN

database('init','mysql:host=localhost;dbname=test','root','root');

Run query and get single column

$uid = sql_value('select id from users where username = ? limit 1', array($username));

Run query and get single row

$user = sql_row('select * from users where username = ?', array($username));
echo $user->email;

Run query and iterate all returned rows

sql_each('select * from users', function($user){
  echo "<li><a href="mailto:{$user->email}">{$user->name}</a></li>";
});

Passing parameters:

sql_each('select * from users where activated = ?', function($user){
  echo "<li><a href="mailto:{$user->email}">{$user->name}</a></li>";
}, array('YES'));

Exec sql command

if ( sql('delete from users where id = ?',array(123)) ) echo "User deleted.";

======================

Contributing

How to get involved:

  1. Star the project!
  2. Answer questions that come through GitHub issues
  3. Report a bug that you find

Core follows the GitFlow branching model. The master branch always reflects a production-ready state while the latest development is taking place in the develop branch.

Each time you want to work on a fix or a new feature, create a new branch based on the develop branch: git checkout -b BRANCH_NAME develop. Only pull requests to the develop branch will be merged.

Pull requests are highly appreciated.

Solve a problem. Features are great, but even better is cleaning-up and fixing issues in the code that you discover.

Versioning

Core is maintained by using the Semantic Versioning Specification (SemVer).

Copyright and license

Copyright 2014 Stefano Azzolini under the MIT license.

Bitdeli Badge

aleph's People

Contributors

bitdeli-chef avatar lastguest avatar

Watchers

 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.