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 3a49041
Showing
18 changed files
with
454 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 @@ | ||
.pinf_packages/ |
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,109 @@ | ||
PHP Module, Package & Program Loader | ||
==================================== | ||
|
||
*Status: DEV* - **WORK IN PROGRESS: YOU MAY GET FRUSTRATED TRYING THIS!** | ||
|
||
The PINF PHP Loader combines what you would traditionally call a **package installer** and | ||
**class loader** and is **intended to be used as the core to all your PHP applications**. | ||
|
||
The loader allows for bootstrapping a state-of-the-art, consistent and portable modular environment | ||
for PHP with the ability to load third party PHP packages from PEAR and other communities following | ||
typical PHP class naming conventions. | ||
|
||
The loader brings [CommonJS Packages/1.1 (draft)](http://wiki.commonjs.org/wiki/Packages/1.1), | ||
[CommonJS Packages/Mappings/C (proposal)](http://wiki.commonjs.org/wiki/Packages/Mappings/C) and further concepts to the PHP platform. | ||
|
||
For more information about the direction this loader is taking see the [JavaScript implementation](https://github.com/pinf/loader-js). | ||
|
||
|
||
Install | ||
======= | ||
|
||
TODO | ||
|
||
|
||
Development | ||
=========== | ||
|
||
[PHPUnit](http://www.phpunit.de/manual/current/en/installation.html) Tests: | ||
|
||
cd ./tests | ||
|
||
phpunit PINF | ||
phpunit demos | ||
|
||
|
||
TODO | ||
==== | ||
|
||
**Questions** | ||
|
||
* How do you tell PHPUnit to disable output buffering when running tests? | ||
|
||
|
||
|
||
Support, Feedback & News | ||
======================== | ||
|
||
* Mailing list: [http://groups.google.com/group/pinf-dev/](http://groups.google.com/group/pinf-dev/) | ||
* Twitter: [http://twitter.com/pinf](http://twitter.com/pinf) | ||
* Blog: [http://christophdorn.com/Blog/](http://christophdorn.com/Blog/) | ||
|
||
|
||
Contribute | ||
========== | ||
|
||
Collaboration Platform: [https://github.com/pinf/loader-php/](https://github.com/pinf/loader-php/) | ||
|
||
Collaboration Process: | ||
|
||
1. Discuss your change on the mailing list | ||
2. Write a patch on your own | ||
3. Send pull request on github & ping mailing list | ||
4. Discuss pull request on github to refine | ||
|
||
You must explicitly license your patch by adding the following to the top of any file you modify | ||
in order for your patch to be accepted: | ||
|
||
// - <GithubUsername>, First Last <Email>, Copyright YYYY, MIT License | ||
|
||
|
||
Author | ||
====== | ||
|
||
This project is a part of the [PINF](http://www.christophdorn.com/Research/#PINF) project maintained by | ||
[Christoph Dorn](http://www.christophdorn.com/). | ||
|
||
|
||
Documentation License | ||
===================== | ||
|
||
[Creative Commons Attribution-NonCommercial-ShareAlike 3.0](http://creativecommons.org/licenses/by-nc-sa/3.0/) | ||
|
||
Copyright (c) 2011+ [Christoph Dorn](http://www.christophdorn.com/) | ||
|
||
|
||
Code License | ||
============ | ||
|
||
[MIT License](http://www.opensource.org/licenses/mit-license.php) | ||
|
||
Copyright (c) 2011+ [Christoph Dorn](http://www.christophdorn.com/) | ||
|
||
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,13 @@ | ||
<?php | ||
|
||
use lang-1/Greetings as Greets1; | ||
use lang-2/Greetings as Greets2; | ||
|
||
|
||
$greeting1 = Greets1::sayHello(); | ||
|
||
echo $greeting1 . "\n"; | ||
|
||
$greeting2 = Greets2::sayHello(); | ||
|
||
echo $greeting2 . "\n"; |
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,6 @@ | ||
{ | ||
"mappings": { | ||
"lang-1": "github.com/pinf/loader-php/demos/StaticMappings/packages/lang-en/", | ||
"lang-2": "github.com/pinf/loader-php/demos/StaticMappings/packages/lang-de/" | ||
} | ||
} |
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,9 @@ | ||
<?php | ||
|
||
class Greetings | ||
{ | ||
public static function sayHello() | ||
{ | ||
return 'Hallo Welt'; | ||
} | ||
} |
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 @@ | ||
{ | ||
} |
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,12 @@ | ||
<?php | ||
|
||
//use ./Words as Words; | ||
|
||
class Greetings | ||
{ | ||
public static function sayHello() | ||
{ | ||
// return Words::get('Hello') . ' ' . Words::get('World'); | ||
return 'Hello World'; | ||
} | ||
} |
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,9 @@ | ||
<?php | ||
|
||
class Words | ||
{ | ||
public static function get($name) | ||
{ | ||
return $name; | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"directories": { | ||
"lib": { | ||
"path": "lib" | ||
} | ||
} | ||
} |
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,20 @@ | ||
{ | ||
"boot": "github.com/pinf/loader-php/demos/StaticMappings/", | ||
"packages": { | ||
"github.com/pinf/loader-php/demos/StaticMappings/": { | ||
"locator": { | ||
"location": "./" | ||
} | ||
}, | ||
"github.com/pinf/loader-php/demos/StaticMappings/packages/lang-en/": { | ||
"locator": { | ||
"location": "./packages/lang-en" | ||
} | ||
}, | ||
"github.com/pinf/loader-php/demos/StaticMappings/packages/lang-de/": { | ||
"locator": { | ||
"location": "./packages/lang-de" | ||
} | ||
} | ||
} | ||
} |
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,42 @@ | ||
<?php | ||
|
||
class PINF_Loader_Autoloader | ||
{ | ||
private static $instance = null; | ||
|
||
private $mappings = array(); | ||
|
||
public static function init() | ||
{ | ||
if (self::$instance === null) | ||
{ | ||
self::$instance = new PINF_Loader_Autoloader(); | ||
spl_autoload_register('PINF_Loader_Autoloader::_loadClass'); | ||
} | ||
return self::$instance; | ||
} | ||
|
||
public static function _loadClass($name) | ||
{ | ||
self::$instance->loadClass($name); | ||
} | ||
|
||
public function loadClass($name) | ||
{ | ||
$name = str_replace('\\', '/', $name); | ||
|
||
$key = substr($name, 0, strpos($name, '/')); | ||
|
||
if (!isset($this->mappings[$key])) | ||
return; | ||
|
||
$path = $this->mappings[$key] . substr($name, strlen($key)) . '.php'; | ||
|
||
require_once($path); | ||
} | ||
|
||
public function addMapping($key, $path) | ||
{ | ||
$this->mappings[$key] = $path; | ||
} | ||
} |
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,8 @@ | ||
<?php | ||
|
||
class PINF_Loader_Descriptor | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
} |
Empty file.
Oops, something went wrong.