Quantum 2

Quantum:超快速php开发的框架。(Quantum: A framework for ultra fast php development)

  • Owner: carlosbarbosamexico/quantum2
  • Platform: BSD, Linux, Mac, Solaris, Windows
  • License::
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

卡洛斯·巴博萨(Carlos Barbosa)的量子2

Quantum 是为超快速 Web 开发而构建的 php 框架。

它是为想要快速完成工作的 php 程序员而构建的。

它集成了 PHP-Activerecord 和 Smarty,使其功能强大。

它具有用于创建模型、控制器和视图的命令行工具:

对于构建控制器:

cd quantum/script

./teleport -c name=blog //Teleports a blog controller
./teleport -m name=post //teleports a post model
./teleport -v controller=blog action=index // teleport an index view

控制器的目的是仅公开公共函数,这样你就可以摆脱:

一个完整的博客控制器,只需3分钟:

class BlogController extends Quantum
{
    function __construct()
    {
    $this->setTemplate('cms);
    }
    function index()
    {
        $posts = Post::all();
        $this->set('posts', $posts);
    }
    function new()
    {
        $this->createPostHook();
    }
    function post()
    {
        if isset($this->getData['id'])
        {
            $post = Post::find_by_id($this->getData['id']);
            if (empty($post))
            {
                redirect_to('/blog');
            }
            $this->set('post', $post);
        }
    }
    private function createPostHook()
    {
        if (isset($this->postData['title]))
        {
            $post = new Post();
            $post->title = $this->postData['title];
            $post->save();
            $this->set('success' 1);
        }
    }    
}

以你的视图为例:

(app/views/blog/index.tpl)

{section name=posts loop=posts}
{$posts[posts]->title}
{$posts[posts]->title}
{/section}

尽管大多数文档都没有记录,但是它已经在许多 Web 应用程序中工作了很多年,尤其是非常适合 Facebook 应用程序(apps)。

全功能:

  • PHP-Activerecord
  • Smarty
  • Teleport 命令行工具
  • QLoader(javascript 加载器)
  • Quantum Javascript 框架,一个用于构建大型 js 应用程序的框架,非常好,它自动将大量 js 编译为一个文件
  • 功能齐全的模板系统($this->setTemplate('something'));只需将 header.tpl 和 footer.tpl 放到 templates 文件夹内的目录中即可。
  • 多站点(从单个代码库进行暂存、开发和生产,无需 hack,只需设置您的 config/environment.php 即可通过检测当前域来工作,以便您可以在 yousite.dev yoursitestaging.com 和 yoursiteproduction.com 上工作。然后 git push 到某个地方)
  • 完整的 MVC 架构。

安装:

  • 将项目克隆到目录中。
  • 将您的网站指向 webroot 文件夹。
  • 在 config/environment.php 中配置数据库

开发:

  • Controllers 位于:app/controllers
  • Models 位于:app/models
  • Views 位于:app/views
  • Filters 位于:app/filters
  • Templates 位于:app/templates
  • Helpers 位于:app/helpers

将浏览器指向 /tests,以便您可以看到控制器在启动后将继承哪些方法。

index.php 是一个元加载器,繁重的加载是在 Quantum.php 内部完成的,可以根据您的需要定制此文件以启动 Quantum,作为示例。

它具有一些用于快速构建 Web api 的函数,例如 Quantum\ApiException::resourceNotFound() 和 Quantum\ApiOutput::adaptableOutput($array);

我保证有一天,如果你们表现出兴趣,将会改善它并记录下来……。

干杯,享受超快的速度,现在不影响 Web 开发。

有任何建议,请通过电子邮件发送至carlosbarbosamexico@gmail.com。


(The first version translated by vz on 2020.08.01)

Main metrics

Overview
Name With Ownercarlosbarbosamexico/quantum2
Primary LanguagePHP
Program languagePHP (Language Count: 3)
PlatformBSD, Linux, Mac, Solaris, Windows
License:
所有者活动
Created At2013-03-15 23:07:38
Pushed At2013-03-16 00:15:32
Last Commit At2013-03-15 18:15:28
Release Count0
用户参与
Stargazers Count3
Watchers Count3
Fork Count1
Commits Count16
Has Issues Enabled
Issues Count0
Issue Open Count0
Pull Requests Count0
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Quantum 2 by Carlos Barbosa

Quantum it's a php framework built for ultra fast web development.

It was built for php programmers who want to get things done fast and well done.

It integrates PHP-Activerecord and Smarty, which make it super powerful.

It features a command line tool for creating models, controllers & views:

For building a controller:

cd quantum/script

./teleport -c name=blog //Teleports a blog controller
./teleport -m name=post //teleports a post model
./teleport -v controller=blog action=index // teleport an index view

Controllers are intended to expose the public functions only, so you can get away with:

A full blog controller in 3 mins:

class BlogController extends Quantum
{

function __construct()
{
$this->setTemplate('cms);

}

function index()
{
	$posts = Post::all();
	
	$this->set('posts', $posts);

}

function new()
{
	$this->createPostHook();

}

function post()
{
	if isset($this->getData['id'])
	{
		$post = Post::find_by_id($this->getData['id']);
		
		if (empty($post))
		{
			redirect_to('/blog');
			
		}
		
		$this->set('post', $post);
	}

}

private function createPostHook()
{
	if (isset($this->postData['title]))
	{
	
		$post = new Post();
		$post->title = $this->postData['title];
		$post->save();
		
		$this->set('success' 1);
	
	}
	

}	

}

And in your view for example:

(app/views/blog/index.tpl);

{section name=posts loop=posts}

{$posts[posts]->title}
{$posts[posts]->title}

{/section}

While most of it is not documented, it has been working for years in many web apps, particularly facebook apps, which is suited for it nicely.

Full features:

  • PHP-Activerecord
  • Smarty
  • Teleport command line tool
  • QLoader (javascript loader)
  • Quantum Javascript framework, a framework for building huge js apps, really nicely, it automatically compiles tons of js into one single file
  • Full featured Template system ($this->setTemplate('something')); just drop a header.tpl and footer.tpl into a directory inside the templates folder.
  • Multi sites, (work on staging, dev & production from a single codebase, no hacks required just set up your config/environment.php, works by detecting the current domain so you can work on yousite.dev yoursitestaging.com and yoursiteproduction.com and just git push somewhere)
  • Full MVC architecture.

Installation:

Clone the project into a dir.
Point your website to the webroot folder.
Configure your db in config/environment.php

Development:

Controllers go in: app/controllers
Models go in: app/models
Views go in: app/views
Filters go in app/filters
Templates to in app/templates
Helpers go in app/helpers

Point your browser to /tests so you can see what methods the controller will inherit after boot.

index.php is a meta loader, the heavy loading, is done inside quantum.php, this file can be customized to your needs to boot quantum as you may seem fit, it is provided as an example.

it features some stuff for building web apis ultra fast, stuff like Quantum\ApiException::resourceNotFound(), and Quantum\ApiOutput::adaptableOutput($array);

I promise some day, if you guys show interest, will improve it and doc it....

Cheers, enjoy ultra fast, no compromises web development, now.

Have comments, email them to carlosbarbosamexico@gmail.com