Skip to content

Commit

Permalink
structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Stuhlmann committed Oct 6, 2017
1 parent baf9071 commit d911dc9
Show file tree
Hide file tree
Showing 121 changed files with 7,239 additions and 5,899 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_autoloader.cache.php
.idea
vendor/
File renamed without changes.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Welcome to the JSMF - The Jan S. MVC Framework

With this framework you can build a whole MVC (Model-View-Controller)-based PHP Application or just use it as a collection of useful PHP classes. All parts of the framework can be used individually.

See the [ApiIndex](docs/ApiIndex.md) for all available classes and methods.
Please refer to the example application while the documentation is in this incomplete state.

## Sample Application Bootstrap
This is only needed if you want to base your whole application on JSMF. You can also use single Classes, using the JSMF autoloader or your own.

Place this code in your applications index file. Route all request thru this file (See this [Gist](https://gist.github.com/RaVbaker/2254618) for an introduction on how to route all requests to index.php with Apache)
Using this minimal setup will let the JSMF\Application class determine the Model/Controller/Action from the request url (http://host/module/controller/action) If one or more url parts are not present, the application will always use the "index" action (the "index" controller, the "index" module). Example: Requesting http://host will try to call module "index" -> IndexController -> indexAction, Request to http://host/misc/faq will call module "misc" -> FaqController -> indexAction

<?php
define('DEV_SERVER', true); // define this
define('SRC', realpath(dirname(__FILE__) . '/../'));
require(SRC . '/lib/JSMF/_autoloader.php');

try {
// optional: load an application wide config
JSMF\Config::load(SRC . '/config/base.config.php');

// optional: load application wide translations
JSMF\Language::loadTranslations(SRC . '/language/translations', 'de');

// optional: route special URLs to special modules / controllers / actions ( I always place the legal texts in a Module named misc)
JSMF\Request::addRoute('/^\/disclaimer\/?$/i', 'misc', 'index', 'disclaimer'); // route a request to /disclaimer to the disclaimer Action in the IndexController in the module "misc"
JSMF\Request::addRoute('/^\/privacy\/?$/i', 'misc', 'index', 'privacy');

// run the application
JSMF\Application::run();

// output the applications response (can be HTML, JSON ...)
JSMF\Response::output();

} catch(JSMF\Exception\NotFound $e) {
// do some special things for not-found errors e.g. redirect to a static 404 page
JSMF\Request::redirect('/404.html');
JSMF\Response::output(); // output method also sends the headers (here: the Location header)

} catch(JSMF\Exception $e) {
// output is done by JSMF
JSMF\Response::output();

} catch(Exception $e) {
// do something on common non-JSMF Exception
}

See also the example code.



2 changes: 0 additions & 2 deletions createdocs.sh

This file was deleted.

42 changes: 21 additions & 21 deletions ApiIndex.md → docs/ApiIndex.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@ API Index
=========

* JSMF
* [Database](JSMF-Database.md)
* [Query](JSMF-Database-Query.md)
* [Statement](JSMF-Database-Statement.md)
* JSMF\Database\Type
* [DBFunction](JSMF-Database-Type-DBFunction.md)
* [Language](JSMF-Language.md)
* [Form](JSMF-Form.md)
* JSMF\Form\Validator
* [MinLength](JSMF-Form-Validator-MinLength.md)
* [Number](JSMF-Form-Validator-Number.md)
* [Equal](JSMF-Form-Validator-Equal.md)
* [ValidatorInterface](JSMF-Form-Validator-ValidatorInterface.md)
* [Date](JSMF-Form-Validator-Date.md)
* [Email](JSMF-Form-Validator-Email.md)
* [Required](JSMF-Form-Validator-Required.md)
* [Equal](JSMF-Form-Validator-Equal.md)
* [Password](JSMF-Form-Validator-Password.md)
* [Date](JSMF-Form-Validator-Date.md)
* [MinLength](JSMF-Form-Validator-MinLength.md)
* [Value](JSMF-Form-Validator-Value.md)
* [Email](JSMF-Form-Validator-Email.md)
* [Element](JSMF-Form-Element.md)
* [Template](JSMF-Template.md)
* [Response](JSMF-Response.md)
* [Repository](JSMF-Repository.md)
* [Request](JSMF-Request.md)
* [Application](JSMF-Application.md)
* [Session](JSMF-Session.md)
* [Email](JSMF-Email.md)
* [Database](JSMF-Database.md)
* [Statement](JSMF-Database-Statement.md)
* [Query](JSMF-Database-Query.md)
* JSMF\Database\Type
* [DBFunction](JSMF-Database-Type-DBFunction.md)
* [Repository](JSMF-Repository.md)
* [Exception](JSMF-Exception.md)
* [NotFound](JSMF-Exception-NotFound.md)
* [UserVisible](JSMF-Exception-UserVisible.md)
* [Response](JSMF-Response.md)
* [Controller](JSMF-Controller.md)
* [Template](JSMF-Template.md)
* [Cache](JSMF-Cache.md)
* [CacheInterface](JSMF-Cache-CacheInterface.md)
* [Redis](JSMF-Cache-Redis.md)
* [CacheInterface](JSMF-Cache-CacheInterface.md)
* [Memcached](JSMF-Cache-Memcached.md)
* [Memcache](JSMF-Cache-Memcache.md)
* [Session](JSMF-Session.md)
* [Config](JSMF-Config.md)
* [Controller](JSMF-Controller.md)
* [Exception](JSMF-Exception.md)
* [NotFound](JSMF-Exception-NotFound.md)
* [UserVisible](JSMF-Exception-UserVisible.md)
* [Email](JSMF-Email.md)
* [Language](JSMF-Language.md)
* [Request](JSMF-Request.md)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions JSMF-Database-Query.md → docs/JSMF-Database-Query.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,4 @@ executes the prepared query




File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions docs/bin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is only needed for generating the Docs!!
8 changes: 8 additions & 0 deletions docs/bin/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "JSMF Docs",
"require-dev": {
"phpdocumentor/phpdocumentor": "2.*",
"evert/phpdoc-md" : "~0.2.0"
}
}

Loading

0 comments on commit d911dc9

Please sign in to comment.