Skip to content

Php mavenisation of the project #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ignore objects and archives, anywhere in the tree.
*.[oa]

# eclipse conf file
.settings
.classpath
.project
.manager
.scala_dependencies
.cache

# idea conf files
.idea
*.iml
*.ipr
*.iws

# svn files
.svn

# mvn dir
\target
\Parkeon-demat-pilote\target
\Parkeon-demat-storage\target
\Parkeon-demat-utils\target
31 changes: 31 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,37 @@ The Epiphany framework only requires PHP 5+, Apache and mod_rewrite. That's all!

----------------------------------------

### Packaging, maven dependency support

epiphany also supports php-maven integration (for detail see Maven <http://maven.apache.org/> and especially PHP maven <http://www.php-maven.org>).

To integrate epiphany in your project, there several way:

1. Sources copy (as usual):

Simply copy sources files which are present in epiphany/main/src/php in your project.
However, you don't beneficiate of dependency management, and then if there is a new version of epiphany, you must manage that manually.

2. Integrate PHP-maven build & dependency tool on your project and simply make a dependency on epiphany framework by adding that in your pom.xml:

<dependency>
<groupId>org.epiphany</groupId>
<artifactId>epiphany</artifactId>
<version>EPIPHANY_VERSION</version>
<type>phar</type>
</dependency>

_Note:_ Think to fix the EPIPHANY_VERSION in the previous snippet.

__TODO:__ Things to be done before a master publish:

1. Fix the official groupId, artefactId and version information in the pom.xml

2. Create a release of epiphany (tag + phar building) and push the artefact to php-maven official repository
+

----------------------------------------

### Getting started

The following links to documentation and articles will help you get up and running in no time. Included in the repository is an example directory with sub applications highlighting the different features of the Epiphany framework.
Expand Down
83 changes: 83 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.phpmaven</groupId>
<artifactId>php-parent-pom</artifactId>
<version>2.0.2</version>
</parent>

<properties>
<phpmaven.release.number>2.0.2</phpmaven.release.number>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<phpunit.version>3.6.10</phpunit.version>
</properties>

<groupId>org.epiphany</groupId> <!-- TODO: specify a valid groupId -->
<artifactId>epiphany</artifactId> <!-- TODO: specify a valid artefactId -->
<version>2.0.1-sogeti-SNAPSHOT</version> <!-- TODO : specify a valid version -->
<packaging>php</packaging>

<name>Epiphany</name>
<description>A micro PHP framework that's fast, easy, clean and RESTful. The framework does not do a lot of magic under the hood. It is, by design, very simple and very powerful.</description>
<url>https://github.com/jmathai/epiphany</url>
<inceptionYear>2009</inceptionYear>

<build>
<plugins>
<plugin>
<groupId>org.phpmaven</groupId>
<artifactId>maven-php-plugin</artifactId>
<version>${phpmaven.plugin.version}</version>

<configuration>
</configuration>
</plugin>
<!-- <plugin>
<groupId>org.sample</groupId>
<artifactId>own-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<extensions>true</extensions>
</plugin> -->

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<inherited>true</inherited>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.phpmaven</groupId>
<artifactId>maven-php-plugin</artifactId>
<version>${phpmaven.plugin.version}</version>
<reportSets>
<reportSet>
<reports>
<report>phpdocumentor</report>
<report>phpunit-coverage</report>
<report>phpunit</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</reportPlugins>
</configuration>
</plugin>

</plugins>
</build>

<dependencies>
<dependency>
<groupId>de.phpunit</groupId>
<artifactId>PHPUnit</artifactId>
<version>${phpunit.version}</version>
<type>phar</type>
<scope>test</scope>
</dependency>
</dependencies>


</project>
2 changes: 1 addition & 1 deletion src/Epi.php → src/main/php/Epi.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static function loadDependency($dep)
if(!is_array($value))
{
if(!isset(self::$included[$value]))
include(self::getPath('base') . "/{$value}");
include(self::getPath('base') . "/{$value}");
self::$included[$value] = 1;
}
else
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 25 additions & 21 deletions src/EpiConfig.php → src/main/php/EpiConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,40 @@ class EpiConfig
{
private static $instance;
private $config;

public function __construct()
{
$this->config = new stdClass;
}

public function load(/*$file, $file, $file, $file...*/)
public function load( /*$file, $file, $file, $file...*/)
{
$args = func_get_args();
foreach($args as $file)
{
// Prepend config directory if the path doesn't start with . or /
if($file[0] != '.' && $file[0] != '/')
$file = Epi::getPath('config') . "/{$file}";
foreach ($args as $file) {
$ps = explode(PATH_SEPARATOR, ini_get('include_path'));
for ($n = 1; $n < count($ps); $n++) {
if (file_exists($ps[$n] . '/' . $file)) {
$file = $ps[$n] . '/' . $file;
} else {
// Prepend config directory if the path doesn't start with . or /
if ($file[0] != '.' && $file[0] != '/')
$file = Epi::getPath('config') . "/{$file}";
}
}

if(!file_exists($file))
{
if (!file_exists($file)) {
EpiException::raise(new EpiConfigException("Config file ({$file}) does not exist"));
break; // need to simulate same behavior if exceptions are turned off
}

$parsed_array = parse_ini_file($file, true);
foreach($parsed_array as $key => $value)
{
if(!is_array($value))
{
foreach ($parsed_array as $key => $value) {
if (!is_array($value)) {
$this->config->$key = $value;
}
else
{
if(!isset($this->config->$key))
} else {
if (!isset($this->config->$key))
$this->config->$key = new stdClass;
foreach($value as $innerKey => $innerValue)
foreach ($value as $innerKey => $innerValue)
$this->config->$key->$innerKey = $innerValue;
}
}
Expand All @@ -43,7 +45,7 @@ public function load(/*$file, $file, $file, $file...*/)

public function get($key = null)
{
if(!empty($key))
if (!empty($key))
return isset($this->config->$key) ? $this->config->$key : null;
else
return $this->config;
Expand All @@ -59,17 +61,19 @@ public function set($key, $val)
*/
public static function getInstance()
{
if(self::$instance)
if (self::$instance)
return self::$instance;

self::$instance = new EpiConfig;
return self::$instance;
}
}
}

function getConfig()
{
return EpiConfig::getInstance();
}

class EpiConfigException extends EpiException {}
class EpiConfigException extends EpiException
{
}
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.
28 changes: 28 additions & 0 deletions src/site/apt/index.apt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----
MY LIBRARY
-----
MY NAME
-----
14-Jun-2010
-----


my project

* Introduction

This is a meaningful sentence.

* Hello World

** My chapter

{{{read-more.html}Read more}}

** My other chapter

amazing...

* Bye Bye

I am no going to sleep
33 changes: 33 additions & 0 deletions src/site/site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="My Project">
<version position="left" />

<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-stylus-skin</artifactId>
<version>1.0</version>
</skin>
<bannerLeft>
<name>php-maven.org</name>
<src>images/mylogo.png</src>
<href>http://www.mydomain.org/</href>
</bannerLeft>
<body>
<links>
<item name="Maven" href="http://maven.apache.org/" />
<item name="PHPUnit" href="http://www.phpunit.de/" />
<item name="doxygen" href="http://www.stack.nl/~dimitri/doxygen/" />
<item name="PHPDocumentor" href="http://www.phpdoc.org/" />
<item name="PHP-Maven" href="http://www.php-maven.org/" />
</links>

<menu name="Main">
<item name="Official site" href="index.html" />
</menu>
<menu name="Some Menu">
<item name="Some Link" href="mylink.html" />
<item name="Some Other Link" href="mylink.html" />
</menu>

</body>
</project>