PHP Classes

PHP Framework From Scratch: Run MVC application with a JSON configuration file

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 77 All time: 10,162 This week: 64Up
Version License PHP version Categories
ffs 1.0GNU General Publi...5PHP 5, Libraries, Configuration, Desi...
Description 

Author

This package can run an MVC application with a JSON configuration file.

It provides an application class that can look at the configured application directories for a configuration in JSON format that defines application details like database access credentials, URL routes, application name, develop or production environment.

The package can process the current request and forward the request handling to the respective controller class depending on the request parameters and the routes defined in the application configuration file.

Picture of Virgilio lino
  Performance   Level  
Innovation award
Innovation award
Nominee: 5x

Winner: 2x

 

Example

<?php
/**
 * todos in order of importance:
 * 0. composer.json. MyApp is one project and Core is the framework. Both projects should be separated
 * 1. ajax security
 * 2. dependency injection -> symfony(ok i know i don't want to use frameworks)
 * 3. postEngine -> when we have dependency injection
 * 4. autoloader -> register namespaces
 * 5. extract viewModel concern from View
 * 6. handle subviews, property to say its a subview and not let app be rendered directly
 * just as a subcall
 * 7. posts and comments templates share a lot of functionalities, boths templates should extend
 * from a generic one
 * 8. model should be comunicated from backend to js.
 * 9. And on js there should be an mvc architecture. at the moment it's everything mixed on class
 * ajaxMaster. this is not good
 * 10. most browsers implement json_parse functionality. for the others i should use some library
 * to add this functionality
 * 11. use less for css
 * 12. avoid double submitting of addpost form
 * 13. email obfuscator
 * 14. validation errors near to the field with error, at the moment, all messages
 * error and success are beign displayed on the pot. having several comments, the user
 * will not see the messages.
 * 15. on every new comment i'm updating all the posts and comments. we should just update this comment
 *
 */
use Ffs\Ffs\Request\HttpRequest;
use
Ffs\Ffs\Response\HttpResponse;
use
Ffs\Ffs\Application\ApplicationFactory;
use
Ffs\Ffs\Application\Config\WebConfig;
require
'../src/Ffs/Autoloader.php';
try {
   
$autoloader = new \Ffs\Autoloader();
   
$responseHandler = new HttpResponse();
   
$applicationFactory = new ApplicationFactory(
        new
WebConfig(), $responseHandler, ApplicationFactory::VAL_WEB_ENVIRONMENT,
       
$autoloader->getAppDir(), 'Ffs\Ffs', 'Ffs\MyApp', 'MyApp'
   
);
   
$myWebApplication = $applicationFactory->create();
   
$myWebApplication->run(new HttpRequest());

} catch (
Exception $e) {
    echo
$e->getMessage();
}




Details

ffs

Ffs - Framework From Scratch built for research purposes. Reinventing the wheel, every functionality without using the power of Open Source

Please consider some functionalities are a little bit raw, well, let's say, ugly. It's just done for research purposes to implement User Driven Development.

Helping

Your help is welcome. Think on a framework, what should have, what should not, and how. There you can help me, i'd like this to be for Frameworks what HURD is for Linux.

Todo's. There is on index.php, or somewhere a list of todo's...But: 1. If you think for example there is not enough separacion of concerns on MVC, and M V and C are not enough decoupled, just let's talk about it. This is the first think i'd like to do. 2. The next step, is to make every functionality independent and replaceble, just like the bundles in Symfony. I'm thinking on creating just services and configurations. Please not overingeneriazation, what i'm searching here, is maybe, overconceptualization. 3. After step 1 and 2, what i'm planning to do, is to implement UDD.

Instructions - Ffs 0.1 -

  1. create database
  2. import the file dbimport.sql
  3. configurate db settings in src/Ffs/Ffs/MyApp/application.conf
  4. point the browser to /Public/index.php

Please take a look at /Public/index.php comment for the list of todos in order of importance.

The code have been tested just with Linux/Chrome and Linux/Firefox. Many thanks, Virgilio Lino virgiliolino@gmail.com


  Files folder image Files (60)  
File Role Description
Files folder imagePublic (1 file, 1 directory)
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file dbimport.sql Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:77
This week:0
All time:10,162
This week:64Up