-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7d9325b
Showing
59 changed files
with
7,707 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# MIT License # | ||
|
||
Copyright (c) 2010-2013 [Phillips Data, Inc.](https://github.com/phillipsdata) | ||
Copyright (c) 2009-2013 [Cody Phillips](https://github.com/clphillips) | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# minPHP # | ||
|
||
minPHP is an extremely lightweight MVC framework for PHP application development. | ||
|
||
## Requirements ## | ||
|
||
* PHP 5.1.3 or greater | ||
|
||
## Getting Started ## | ||
|
||
1. Extract all the contents of the /src/ directory to a publically accessible web directory. | ||
2. Load the web directory in your browser. | ||
3. If your webserver does not support .htaccess files, delete the .htaccess file in the /src/ directory. You will need to access all URIs with a preceding "index.php/". | ||
|
||
### Controlls, Views, and URIs ### | ||
|
||
**Controllers** are PHP class files that handle URI requests. Each controller and controller method (known as an **action**) represent a URI segment. For example, the "Foo" controller can be accessed at ```/foo/```. This would automatically invoke the ```Foo::index()``` method. This method could explicitly be invoked using the ```/foo/index/``` URI. Similarly, the "bar" method of Foo can be accessed at ```/foo/bar/```. | ||
|
||
Each **View** is linked to a specific action. That is, each controller method has its own view. A view is simply a PHP Data Template (.pdt file), which typically contain HTML and PHP. The view for ```/foo/index/``` would be ```foo.pdt```. The view for ```/foo/bar/``` would be ```foo_bar.pdt```. Views are located in the ```/src/app/views/default/``` directory. | ||
|
||
Controllers are initialized with two view objects. One for the action's view and another called "structure". The structure view (```/src/app/views/default/structure.pdt```) contains the content used in all views. | ||
|
||
### Passing Variables to Views ### | ||
|
||
Passing variables to views from a controller is simple: | ||
|
||
```php | ||
<?php | ||
class Foo extends AppController { | ||
|
||
public function index() { | ||
|
||
$my_var = array(1,2,3); | ||
|
||
$this->set("my_var", $my_var); | ||
} | ||
|
||
} | ||
?> | ||
``` | ||
|
||
You can also set multiple variables all at once: | ||
|
||
```php | ||
<?php | ||
class Foo extends AppController { | ||
|
||
public function index() { | ||
|
||
$my_var = array(1,2,3); | ||
$my_other_var = array("a","b","c"); | ||
|
||
$this->set(compact("my_var", "my_other_var")); | ||
} | ||
|
||
} | ||
?> | ||
``` | ||
|
||
To set variables in the structure view use: | ||
|
||
```php | ||
$this->structure->set("my_var", $my_var); | ||
``` | ||
|
||
### Directory Structure ### | ||
|
||
<pre> | ||
/app | ||
/controllers - where all controllers are to be placed | ||
/models - where all models are to be placed | ||
/views - where all views are to be placed | ||
/default - a collection of related display components | ||
/css | ||
/images | ||
/javascript | ||
/cache - where cached views are stored (must be writable to use) | ||
/components - where components are placed | ||
/config - where configuration files are to be stored | ||
/helpers - where all helpers are located | ||
/language - each language has its own directory in here | ||
/en_us - the default language directory | ||
/lib - where all core minPHP files are located | ||
/plugins - where all minPHP plugins are stored | ||
/vendors - where vendor code is placed (i.e. third party libraries) | ||
</pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<project name="minPHP" default="build"> | ||
<target name="build" | ||
depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,apigen,phpunit,phpcb"/> | ||
|
||
<target name="build-parallel" | ||
depends="prepare,lint,tools-parallel,phpunit,phpcb"/> | ||
|
||
<target name="tools-parallel" description="Run tools in parallel"> | ||
<parallel threadCount="2"> | ||
<sequential> | ||
<antcall target="pdepend"/> | ||
<antcall target="phpmd-ci"/> | ||
</sequential> | ||
<antcall target="phpcpd"/> | ||
<antcall target="phpcs-ci"/> | ||
<antcall target="phploc"/> | ||
<antcall target="apigen"/> | ||
</parallel> | ||
</target> | ||
|
||
<target name="clean" description="Cleanup build artifacts"> | ||
<delete dir="${basedir}/build/api"/> | ||
<delete dir="${basedir}/build/code-browser"/> | ||
<delete dir="${basedir}/build/coverage"/> | ||
<delete dir="${basedir}/build/logs"/> | ||
<delete dir="${basedir}/build/pdepend"/> | ||
</target> | ||
|
||
<target name="prepare" depends="clean" description="Prepare for build"> | ||
<mkdir dir="${basedir}/build/api"/> | ||
<mkdir dir="${basedir}/build/code-browser"/> | ||
<mkdir dir="${basedir}/build/coverage"/> | ||
<mkdir dir="${basedir}/build/logs"/> | ||
<mkdir dir="${basedir}/build/pdepend"/> | ||
<mkdir dir="${basedir}/build/apigen"/> | ||
</target> | ||
|
||
<target name="lint" description="Perform syntax check of sourcecode files"> | ||
<apply executable="php" failonerror="true"> | ||
<arg value="-l" /> | ||
|
||
<fileset dir="${basedir}/src"> | ||
<include name="**/*.php" /> | ||
<modified /> | ||
</fileset> | ||
|
||
<fileset dir="${basedir}/tests"> | ||
<include name="**/*.php" /> | ||
<modified /> | ||
</fileset> | ||
</apply> | ||
</target> | ||
|
||
<target name="phploc" description="Measure project size using PHPLOC"> | ||
<exec executable="phploc"> | ||
<arg value="--log-csv" /> | ||
<arg value="${basedir}/build/logs/phploc.csv" /> | ||
<arg path="${basedir}/src" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="pdepend" description="Calculate software metrics using PHP_Depend"> | ||
<exec executable="pdepend"> | ||
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" /> | ||
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" /> | ||
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" /> | ||
<arg path="${basedir}/src" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="phpmd" | ||
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing."> | ||
<exec executable="phpmd"> | ||
<arg path="${basedir}/src" /> | ||
<arg value="text" /> | ||
<arg value="${basedir}/build/phpmd.xml" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server"> | ||
<exec executable="phpmd"> | ||
<arg path="${basedir}/src" /> | ||
<arg value="xml" /> | ||
<arg value="${basedir}/build/phpmd.xml" /> | ||
<arg value="--reportfile" /> | ||
<arg value="${basedir}/build/logs/pmd.xml" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="phpcs" | ||
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing."> | ||
<exec executable="phpcs"> | ||
<arg value="--standard=${basedir}/build/phpcs.xml" /> | ||
<arg path="${basedir}/src" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server"> | ||
<exec executable="phpcs" output="/dev/null"> | ||
<arg value="--report=checkstyle" /> | ||
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" /> | ||
<arg value="--standard=${basedir}/build/phpcs.xml" /> | ||
<arg path="${basedir}/src" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="phpcpd" description="Find duplicate code using PHPCPD"> | ||
<exec executable="phpcpd"> | ||
<arg value="--log-pmd" /> | ||
<arg value="${basedir}/build/logs/pmd-cpd.xml" /> | ||
<arg path="${basedir}/src" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="phpunit" description="Run unit tests with PHPUnit"> | ||
<exec executable="phpunit" failonerror="true"> | ||
<arg line="-c ${basedir}/build/phpunit.xml" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="apigen" description="Generate API documentation using apigen"> | ||
<exec executable="apigen"> | ||
<arg value="--config" /> | ||
<arg path="${basedir}/build/apigen.neon" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser"> | ||
<exec executable="phpcb"> | ||
<arg value="--log" /> | ||
<arg path="${basedir}/build/logs" /> | ||
<arg value="--source" /> | ||
<arg path="${basedir}/src" /> | ||
<arg value="--output" /> | ||
<arg path="${basedir}/build/code-browser" /> | ||
</exec> | ||
</target> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Source file or directory to parse | ||
source: ../src/ | ||
# Directory where to save the generated documentation | ||
destination: ./apigen/ | ||
# List of allowed file extensions | ||
extensions: [php] | ||
# Mask to exclude file or directory from processing | ||
exclude: | ||
# Don't generate documentation for classes from file or directory with this mask | ||
skipDocPath: | ||
# Don't generate documentation for classes with this name prefix | ||
skipDocPrefix: | ||
# Character set of source files | ||
charset: auto | ||
# Main project name prefix | ||
main: minPHP | ||
|
||
# Title of generated documentation | ||
title: minPHP | ||
# Documentation base URL | ||
baseUrl: | ||
# Google Custom Search ID | ||
googleCseId: | ||
# Google Custom Search label | ||
googleCseLabel: | ||
# Google Analytics tracking code | ||
googleAnalytics: | ||
# Template config file | ||
templateConfig: '/Applications/MAMP/htdocs/apigen/templates/bootstrap/config.neon' | ||
# Grouping of classes | ||
groups: auto | ||
# List of allowed HTML tags in documentation | ||
allowedHtml: [b, i, a, ul, ol, li, p, br, var, samp, kbd, tt] | ||
# Element types for search input autocomplete | ||
autocomplete: [classes, constants, functions] | ||
|
||
# Generate documentation for methods and properties with given access level | ||
accessLevels: [public, protected, private] | ||
# Generate documentation for elements marked as internal and display internal documentation parts | ||
internal: No | ||
# Generate documentation for PHP internal classes | ||
php: Yes | ||
# Generate tree view of classes, interfaces and exceptions | ||
tree: Yes | ||
# Generate documentation for deprecated classes, methods, properties and constants | ||
deprecated: Yes | ||
# Generate documentation of tasks | ||
todo: No | ||
# Generate highlighted source code files | ||
sourceCode: Yes | ||
# Add a link to download documentation as a ZIP archive | ||
download: No | ||
# Save a checkstyle report of poorly documented elements into a file | ||
report: ./logs/apigen.txt | ||
|
||
# Wipe out the destination directory first | ||
wipeout: Yes | ||
# Don't display scanning and generating messages | ||
quiet: No | ||
# Display progressbars | ||
progressbar: Yes | ||
# Use colors | ||
colors: No | ||
# Check for update | ||
updateCheck: Yes | ||
# Display additional information in case of an error | ||
debug: No |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<checkstyle version="1.3.0"> | ||
</checkstyle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<PDepend> | ||
<Packages/> | ||
<Cycles/> | ||
</PDepend> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<testsuites> | ||
<testsuite name="ProjectName" tests="0" assertions="0" failures="0" errors="0" time="0.000000"/> | ||
</testsuites> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Lines of Code (LOC),Cyclomatic Complexity / Lines of Code,Comment Lines of Code (CLOC),Non-Comment Lines of Code (NCLOC),Namespaces,Interfaces,Traits,Classes,Abstract Classes,Concrete Classes,Average Class Length (NCLOC),Methods,Non-Static Methods,Static Methods,Public Methods,Non-Public Methods,Average Method Length (NCLOC),Cyclomatic Complexity / Number of Methods,Anonymous Functions,Functions,Constants,Global Constants,Class Constants | ||
2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<pmd-cpd/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<pmd version="1.4.0" timestamp="2012-10-15T06:15:49+02:00"> | ||
</pmd> |
Oops, something went wrong.