-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Primary example Prado Composer Extension
- Loading branch information
0 parents
commit 6a62bff
Showing
8 changed files
with
244 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,21 @@ | ||
# cache directories | ||
Thumbs.db | ||
*.DS_Store | ||
*.empty | ||
|
||
#phpstorm project files | ||
.idea | ||
|
||
#netbeans project files | ||
nbproject | ||
|
||
#eclipse, zend studio, aptana or other eclipse like project files | ||
.buildpath | ||
.project | ||
.settings | ||
|
||
|
||
# mac deployment helpers | ||
switch | ||
index | ||
.php-cs-fixer.cache |
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,44 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->exclude('docs/') | ||
->exclude('tests/') | ||
->exclude('vendor/') | ||
->in(__DIR__); | ||
|
||
$config = new PhpCsFixer\Config(); | ||
$config | ||
->setRiskyAllowed(true) | ||
->setIndent("\t") | ||
->setLineEnding("\n") | ||
->setRules([ | ||
'@PSR2' => true, | ||
'align_multiline_comment' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'binary_operator_spaces' => true, | ||
'blank_line_after_namespace' => true, | ||
'blank_line_after_opening_tag' => true, | ||
'cast_spaces' => ['space' => 'single'], | ||
'combine_nested_dirname' => true, | ||
'concat_space' => ['spacing' => 'one'], | ||
'dir_constant' => true, | ||
'is_null' => true, | ||
'list_syntax' => ['syntax' => 'short'], | ||
'modernize_types_casting' => true, | ||
'no_alias_functions' => true, | ||
'no_null_property_initialization' => true, | ||
'no_whitespace_before_comma_in_array' => true, | ||
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false], | ||
'phpdoc_order' => true, | ||
'phpdoc_scalar' => true, | ||
'phpdoc_types_order' => true, | ||
'psr_autoloading' => true, | ||
'ternary_operator_spaces' => true, | ||
'ternary_to_null_coalescing' => true, | ||
'trim_array_spaces' => true, | ||
'visibility_required' => true, | ||
'whitespace_after_comma_in_array' => true, | ||
]) | ||
->setFinder($finder); | ||
|
||
return $config; |
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,31 @@ | ||
The PRADO framework and the included examples are free software. | ||
They are released under the terms of the following BSD License. | ||
|
||
Copyright 2004-2021, The PRADO Group (https://github.com/pradosoft) | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
- Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
- Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
- Neither the name of the of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,61 @@ | ||
PRADO Composer Extension example | ||
===================================== | ||
|
||
This is a Minimal base composer extension for PRADO Framework. This automatically adds the Pages directory to the TPageService::onAdditionalPagePaths and loads the errorMessages. | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
The preferred way to install this extension is through [composer](http://getcomposer.org/download/). | ||
|
||
Either run | ||
|
||
``` | ||
php composer.phar require --prefer-dist pradosoft/prado-composer-extension "*" | ||
``` | ||
|
||
or add | ||
|
||
``` | ||
"pradosoft/prado-composer-extension": "*" | ||
``` | ||
|
||
to the require section of your `composer.json` file. | ||
|
||
|
||
Setup | ||
----- | ||
|
||
Once the extension is installed, load the extension in your Prado application config by specifying the extension name as a module id. | ||
|
||
Add the module to the application configuration without the class. For example, like this: | ||
|
||
```xml | ||
<modules> | ||
<module id="pradosoft/prado-composer-extension" PropertyA='value1' /> | ||
</module> | ||
``` | ||
|
||
|
||
Usage | ||
----- | ||
|
||
Add the following Application Parameter to your application configuration: PluginContentId. for example like this: | ||
|
||
```xml | ||
<parameters> | ||
<parameer id="PluginContentId" value='my-layout-content-id' /> | ||
</parameters> | ||
``` | ||
|
||
Set the PluginContentId to the name of the main TPlaceholderContent ID of your layout so the plugins can be loaded properly. | ||
|
||
Follow the panel link to http://application/web/index.php?page=Example | ||
On the index page you'll see extension specific content. | ||
|
||
|
||
Extension | ||
--------- | ||
|
||
The composer.json uses a "type" of "prado4-extension" and will load the class from ["extra"]["bootstrap"] for the module id/package name. Use these specific parameters and values to designate and use your own prado composer extension. |
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,30 @@ | ||
{ | ||
"name": "pradosoft/prado-composer-extension", | ||
"version": "v1.0.0", | ||
"version_normalized": "1.0.0.0", | ||
"description": "The Base example PRADO Composer Extension", | ||
"license": "BSD-3-Clause", | ||
"type": "prado4-extension", | ||
"keywords": [ "prado", "framework", "example", "extension"], | ||
"homepage": "https://github.com/pradosoft/prado-composer-extension", | ||
"authors": [ | ||
{ | ||
"name": "Brad Anderson", | ||
"email": "[email protected]", | ||
"role": "Developer", | ||
"homepage": "https://github.com/belisoful" | ||
} | ||
], | ||
"notification-url": "https://packagist.org/downloads/", | ||
"autoload": { | ||
"psr-4": { | ||
"PradoComposerExtension\\": "src" | ||
} | ||
}, | ||
"require": { | ||
"pradosoft/prado" : "4.2.0" | ||
}, | ||
"extra": { | ||
"bootstrap": "PradoComposerExtension\\MainModule" | ||
} | ||
} |
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,53 @@ | ||
<?php | ||
/** | ||
* MainModule class file | ||
* | ||
* @author Brad Anderson <[email protected]> | ||
* @link https://github.com/pradosoft/prado-composer-extension | ||
* @license https://github.com/pradosoft/prado-composer-extension/blob/master/LICENSE | ||
* @package PradoComposerExtension | ||
*/ | ||
namespace PradoComposerExtension; | ||
|
||
use Prado\TPropertyValue; | ||
use Prado\Util\TPluginModule; | ||
|
||
/** | ||
* MainModule class. | ||
* | ||
* main example bootstrap module class | ||
* | ||
* @author Brad Anderson <[email protected]> | ||
* @package PradoComposerExtension | ||
* @since 1.0.0 | ||
*/ | ||
class MainModule extends TPluginModule | ||
{ | ||
/** @var null|string property A */ | ||
private $_propertya; | ||
|
||
/** | ||
* Initializes the module, call the parent:init. | ||
* @param null|array|TXmlElement $config | ||
*/ | ||
public function init($config) | ||
{ | ||
parent::init($config); | ||
} | ||
|
||
/** | ||
* @return null|string gets the Property A from the module | ||
*/ | ||
public function getPropertyA() | ||
{ | ||
return $this->_propertya; | ||
} | ||
|
||
/** | ||
* @param null|string $v sets the Property A from the module | ||
*/ | ||
public function setPropertyA($v) | ||
{ | ||
$this->_propertya = TPropertyValue::ensureString($v); | ||
} | ||
} |
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 @@ | ||
<com:TContent ID=<%$ PluginContentId %>> | ||
Page from Prado-Composer-Extension. | ||
</com:TContent> |
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 @@ | ||
my_error_condition = Prado Composer Extension threw an exception |