All Projects → lastguest → aleph

lastguest / aleph

Licence: MIT license
A simple PHP framework for very small sites

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to aleph

Easy Php
A Faster Lightweight Full-Stack PHP Framework 🚀
Stars: ✭ 754 (+5285.71%)
Mutual labels:  lightweight, php-framework
core
Platform for rapid application development.
Stars: ✭ 31 (+121.43%)
Mutual labels:  php-framework, microframework
ThreadPool2
Lightweight, Generic, Pure C++11 ThreadPool
Stars: ✭ 28 (+100%)
Mutual labels:  lightweight
repair
ระบบบันทึกข้อมูลงานซ่อม
Stars: ✭ 24 (+71.43%)
Mutual labels:  php-framework
ytmous
Anonymous Youtube Proxy
Stars: ✭ 60 (+328.57%)
Mutual labels:  lightweight
hugoblog
Hugoblog is responsive, simple, and clean that would fit for your personal blog based on Hugo Theme Static Site Generator (SSG)
Stars: ✭ 48 (+242.86%)
Mutual labels:  lightweight
wui
Collection of GUI widgets for the web
Stars: ✭ 44 (+214.29%)
Mutual labels:  lightweight
Moveto
A lightweight scroll animation javascript library without any dependency
Stars: ✭ 2,746 (+19514.29%)
Mutual labels:  lightweight
natick
natickOS - A minimal, lightweight, research Linux Distribution
Stars: ✭ 33 (+135.71%)
Mutual labels:  lightweight
rh
Resource Harvester - a tool to gather low-level system data and make it easy to use programmatically
Stars: ✭ 18 (+28.57%)
Mutual labels:  lightweight
protobluff
A modular Protocol Buffers implementation for C
Stars: ✭ 66 (+371.43%)
Mutual labels:  lightweight
Lucid-Browser
Source code for Lucid browser on Play Store
Stars: ✭ 103 (+635.71%)
Mutual labels:  lightweight
string-combinations
A simple, low-memory footprint function to generate all string combinations from a series of characters.
Stars: ✭ 25 (+78.57%)
Mutual labels:  lightweight
MachineLearning
An easy neural network for Java!
Stars: ✭ 125 (+792.86%)
Mutual labels:  lightweight
fir
Fir. A lightweight PHP MVC Framework.
Stars: ✭ 33 (+135.71%)
Mutual labels:  php-framework
velox
The minimal PHP micro-framework.
Stars: ✭ 55 (+292.86%)
Mutual labels:  php-framework
simple-jwt-provider
No description or website provided.
Stars: ✭ 33 (+135.71%)
Mutual labels:  lightweight
lightcookie
Node cookie parsing and serialization
Stars: ✭ 22 (+57.14%)
Mutual labels:  lightweight
jpopup
Simple lightweight (<2kB) javascript popup modal plugin
Stars: ✭ 27 (+92.86%)
Mutual labels:  lightweight
backup-repository
Backup storage for E2E GPG-encrypted files, with multi-user, quotas, versioning, using a object storage (S3/Min.io/GCS etc.) and deployed on Kubernetes or standalone.
Stars: ✭ 21 (+50%)
Mutual labels:  lightweight

Aleph

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

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

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

Boostrap


Include composer vendor/autoload.php

<?php
include 'vendor/autoload.php';

or directly the aleph.php file in your front controller:

<?php
include 'aleph.php';

URL Routing


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

// Listen POST on /
post('/',function(){
  echo "<h1>Received POST Data:</h1><pre>";
  print_r($_POST);
  echo "</pre>";
});

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" ],
  ];
});

The response will be :

[
    {
        "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.";

Service


The Service function is a small DI container.

Register a factory method

class TestService {
	public $value;
	function __construct($x){ $this->value = $x; }
}

service('test',function($x){
	return new TestService($x);
});

Make service instances

$a = service('test',3);
$b = service('test',5);
[{"value":3},{"value":5}]

Register a singleton service

service('test',function($x){
	static $instance = null;
	return $instance === null ? $instance = new TestService($x) : $instance;
});

Now if we call multiple times the service('test') function we got the singleton instance every time :

$a = service('test',3);
$b = service('test',5);
$c = service('test');
[{"value":3},{"value":3},{"value":3}]

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

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].