Skip to content

Commit 46f55c3

Browse files
authored
Merge pull request #209 from dotkernel/develop
Refactor to use only .md files and add tests
2 parents cfb3d3c + cb103ff commit 46f55c3

401 files changed

Lines changed: 1347 additions & 24093 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎composer.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@
3636
"dotkernel/dot-response-header": "^3.6",
3737
"laminas/laminas-component-installer": "^3.5.0",
3838
"laminas/laminas-config-aggregator": "^1.17.0",
39+
"league/commonmark": "^2.10",
3940
"mezzio/mezzio": "^3.24.0",
4041
"mezzio/mezzio-fastroute": "^3.13.0",
4142
"mezzio/mezzio-twigrenderer": "^2.17.0",
4243
"ramsey/uuid": "^4.5.0",
4344
"ramsey/uuid-doctrine": "^2.1.0",
44-
"roave/psr-container-doctrine": "^5.2.2 || ^6.0.0"
45+
"roave/psr-container-doctrine": "^5.2.2 || ^6.0.0",
46+
"symfony/yaml": "^8.1",
47+
"twig/markdown-extra": "^3.28"
4548
},
4649
"require-dev": {
4750
"filp/whoops": "^2.17.0",

‎config/autoload/templates.global.php‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
declare(strict_types=1);
44

5+
use Twig\Extra\Markdown\MarkdownExtension;
6+
use Twig\RuntimeLoader\RuntimeLoaderInterface;
7+
58
return [
69
'templates' => [
710
'extension' => 'html.twig',
@@ -12,10 +15,14 @@
1215
'autoescape' => 'html',
1316
'auto_reload' => true,
1417
'cache_dir' => 'data/cache/twig',
15-
'extensions' => [],
18+
'extensions' => [
19+
MarkdownExtension::class,
20+
],
1621
'globals' => [],
1722
'optimizations' => -1,
18-
'runtime_loaders' => [],
23+
'runtime_loaders' => [
24+
RuntimeLoaderInterface::class,
25+
],
1926
'timezone' => 'UTC',
2027
],
2128
];

‎public/md-articles/architecture/configprovider-bootstrap-modern-php-applications.md‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ class ConfigProvider
3434
{
3535
public function __invoke(): array
3636
{
37-
return [ /* ... */ ];
37+
return [
38+
'dependencies' => $this->getDependencies(),
39+
'templates' => $this->getTemplates(),
40+
];
3841
}
3942

4043
public function getDependencies(): array
@@ -59,7 +62,7 @@ What each item means:
5962

6063
| Item | Meaning |
6164
|---|---|
62-
| `dependencies` | Used by the dependency injector (e.g. laminas-servicemanager) to construct every requested service. |
65+
| `dependencies` | Used by the dependency injector (e.g. [laminas-servicemanager](https://docs.mezzio.dev/mezzio/v3/features/container/laminas-servicemanager/)) to construct every requested service. |
6366
| `factories` | The factory builds the service. |
6467
| `invokables` | The service is built with `new` directly. |
6568
| `aliases` | Redirects to another service name. |
@@ -74,15 +77,19 @@ The ConfigProvider is automatically picked up by the framework during applicatio
7477
2. **Read the configuration array** - A call similar to `$config = $container->get('config') ?? [];` reads an array of entries.
7578
3. **Resolve item** - `$app->pipe()` is called to resolve one of the following: resolve the service name from the container, wrap the middleware if an array is provided, or call the closure or invokable object.
7679
4. **Handle errors** - The error-handling middleware is the last one in the pipeline, to make sure it can handle any exceptions.
77-
5. **Execute at runtime** - Laminas Stratigility iterates over the pipeline in the order it was registered. Each middleware can handle the request and return a response, or delegate execution to the next middleware in the pipeline, until a `ResponseInterface` is returned to the client.
80+
5. **Execute at runtime** - [Laminas Stratigility](https://docs.laminas.dev/laminas-stratigility/) iterates over the pipeline in the order it was registered. Each middleware can handle the request and return a response, or delegate execution to the next middleware in the pipeline, until a `ResponseInterface` is returned to the client.
81+
82+
Below you can see how Mezzio and Dotkernel merge and use ConfigProviders to build the middleware pipeline and dependencies.
83+
84+
![](/uploads/article/019f8a80-cc92-7277-92c8-c0e68d81615f/ConfigProvider2.png)
7885

7986
## Benefits
8087

8188
- **Centralized setup** - Instead of hardcoding bootstrap code, it's declared in a config provider so it's easy to read, change, or extend.
8289
- **Modular** - Each package can ship with its own config without interfering with others.
8390
- **Container-friendly** - Works well with frameworks using DI containers like Laminas ServiceManager, PHP-DI, or Pimple.
8491
- **Standardized service definitions** - Consistent rules for object creation, separate from business logic.
85-
- **Auto-Discovery** - In Laminas/Mezzio, the ConfigAggregator automatically loads and merges all ConfigProviders.
92+
- **Auto-Discovery** - In Laminas/Mezzio, the [ConfigAggregator](https://docs.laminas.dev/laminas-config-aggregator/) automatically loads and merges all ConfigProviders.
8693
Dotkernel is an exception: new ConfigProviders have to be added manually in `config/config.php`, because all the initial ConfigProviders required to install the applications are already injected.
8794
- **Environment-agnostic** - Returns an array that defines dev, test, or prod environments.
8895
- **Testability** - The consistent, central configuration promotes isolated (e.g. per-module) testing, easier swapping of dependencies, and assertion of pipeline setup (e.g. checking if a config key is present).

‎public/md-articles/best-practice/aptana-set-svn-keywords.md‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,37 @@ language: "en"
1010

1111
# Aptana - set SVN keywords
1212

13-
## Overview
13+
In Aptana it's very simple to set the [svn:keywords](http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html) property for a file.
1414

15-
In Aptana it's very simple to set the svn:keywords property for a file.
16-
For example, to set the svn keyword property `Id`:
15+
For example if you want to set the svn keyword property ***Id***:
1716

18-
## Steps
17+
1. In the file where you want to add the svn keyword property write **$Id$**
1918

20-
1. In the file where the svn keyword property should be added, write `$Id$`.
21-
2. Right click on the file, then follow Team -> Set Property...
22-
(Note: "Set Property..." will not be active if the file hasn't first been added to SVN via Team -> Add to Version Controller).
23-
3. Select `svn:keywords`, and write `Id` in the text field.
19+
![](/uploads/article/019f8a80-cc86-73d9-a427-0621b2a55777/id-file-300x235.gif)
2420

25-
When the SVN commit of the file is made, the `$Id$` keyword will be replaced with text containing the file's SVN metadata, in a specific format.
21+
2. Right click on the file, then follow Team -> Set Property...**Note**: *Set Property...* will not be active if you haven't first added the file to SVN: *Team*->*Add to Version Controller*
22+
23+
![](/uploads/article/019f8a80-cc86-73d9-a427-0621b2a55777/set-property-300x152.gif)
24+
25+
3. Select **svn:keywords**, and write **Id** in the text field
26+
27+
![](/uploads/article/019f8a80-cc86-73d9-a427-0621b2a55777/svn-keywords-300x298.gif)
28+
29+
When you make the SVN commit of the file, the *$Id$* keyword will be replaced with text in the format shown below:
30+
31+
![](/uploads/article/019f8a80-cc86-73d9-a427-0621b2a55777/id-file-svn-300x141.gif)
2632

2733
## FAQ
2834

2935
**Q: How do you set the svn:keywords property for a file in Aptana?**
30-
A: Write the keyword marker (for example `$Id$`) in the file, then right click the file and follow Team -> Set Property..., select `svn:keywords`, and write `Id` in the text field.
36+
A: Write the keyword marker (for example $Id$) in the file, then right click the file and follow Team -> Set Property..., select svn:keywords, and write Id in the text field.
3137

3238
**Q: Why is "Set Property..." not active when I right click the file?**
3339
A: Set Property... will not be active if the file hasn't first been added to SVN.
3440
Use Team -> Add to Version Controller before trying to set the property.
3541

3642
**Q: What happens to the $Id$ keyword after an SVN commit?**
37-
A: After the SVN commit of the file, the `$Id$` keyword is replaced with text containing the file's SVN metadata, in a specific format.
43+
A: After the SVN commit of the file, the $Id$ keyword is replaced with text containing the file's SVN metadata, in a specific format.
3844

3945
## Resources
4046

0 commit comments

Comments
 (0)