Full stack framework based on symfony's components
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/gonzalo123/g
Requires
- doctrine/dbal: 2.3.4
 - symfony/config: v2.3.1
 - symfony/dependency-injection: v2.3.1
 - symfony/event-dispatcher: v2.3.1
 - symfony/http-foundation: v2.3.1
 - symfony/http-kernel: v2.3.1
 - symfony/routing: v2.3.1
 - symfony/yaml: v2.3.1
 - twig/twig: v1.13.1
 
Requires (Dev)
- phpunit/phpunit: 3.7.22
 
This package is not auto-updated.
Last update: 2025-11-03 22:11:10 UTC
README
instalation:
composer
{
    "require": {
        "gonzalo123/g": "dev-master"
    },
    "autoload": {
        "psr-0": {
            "": ["app/"]
        }
    }
}
index.php:
<?php include __DIR__ . '/vendor/autoload.php'; $app = G\Application::factory([ 'config.path' => __DIR__ . '/config', 'view.path' => __DIR__ . '/views', ]); $app->run();
config and view folders
mkdir config
mkdir view
/config/routes.yml
home:
  path: /
  defaults: { _controller: AppController::homeAction}
/config/services.yml
services:
  Symfony\Component\HttpFoundation\JSonResponse:
    class: Symfony\Component\HttpFoundation\JSonResponse
  Symfony\Component\HttpFoundation\Response:
    class: Symfony\Component\HttpFoundation\Response
Controller
<?php class AppController { public function homeAction() { return "AppController::home"; } }
Complex controller
another route:
hello:
  path: /hello/{name}
  defaults: { _controller: AppController::helloAction}
class AppController { private $request; public function __construct(Request $request) { $this->request = $request; } public function helloAction($name, JsonResponse $response) { return $response->setData([$name, 1, 2]); } }
RESTFull controllers
we add to our services.yml:
restResources:
  book:
    path: /resource/book
    class: BookResource
And we define our BookResource
<?php use G\RESTFull\Get; use G\RESTFull\GetAll; use G\RESTFull\Delete; use G\RESTFull\Create; use G\RESTFull\Update; class BookResource implements Get, GetAll, Delete, Create, Update { public function getAction($id) { return "BookResource:getAction " . $id; } public function getAllAction() { return "BookResource:getAllAction"; } public function saveAction($id) { return "BookResource:saveAction " . $id; } public function addAction() { return "BookResource:addAction"; } public function deleteAction($id) { return "BookResource:deleteAction " . $id; } }