Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@
"dotkernel/dot-response-header": "^3.6",
"laminas/laminas-component-installer": "^3.5.0",
"laminas/laminas-config-aggregator": "^1.17.0",
"league/commonmark": "^2.10",
"mezzio/mezzio": "^3.24.0",
"mezzio/mezzio-fastroute": "^3.13.0",
"mezzio/mezzio-twigrenderer": "^2.17.0",
"ramsey/uuid": "^4.5.0",
"ramsey/uuid-doctrine": "^2.1.0",
"roave/psr-container-doctrine": "^5.2.2 || ^6.0.0"
"roave/psr-container-doctrine": "^5.2.2 || ^6.0.0",
"symfony/yaml": "^8.1",
"twig/markdown-extra": "^3.28"
},
"require-dev": {
"filp/whoops": "^2.17.0",
Expand Down
11 changes: 9 additions & 2 deletions config/autoload/templates.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

declare(strict_types=1);

use Twig\Extra\Markdown\MarkdownExtension;
use Twig\RuntimeLoader\RuntimeLoaderInterface;

return [
'templates' => [
'extension' => 'html.twig',
Expand All @@ -12,10 +15,14 @@
'autoescape' => 'html',
'auto_reload' => true,
'cache_dir' => 'data/cache/twig',
'extensions' => [],
'extensions' => [
MarkdownExtension::class,
],
'globals' => [],
'optimizations' => -1,
'runtime_loaders' => [],
'runtime_loaders' => [
RuntimeLoaderInterface::class,
],
'timezone' => 'UTC',
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class ConfigProvider
{
public function __invoke(): array
{
return [ /* ... */ ];
return [
'dependencies' => $this->getDependencies(),
'templates' => $this->getTemplates(),
];
}

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

| Item | Meaning |
|---|---|
| `dependencies` | Used by the dependency injector (e.g. laminas-servicemanager) to construct every requested service. |
| `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. |
| `factories` | The factory builds the service. |
| `invokables` | The service is built with `new` directly. |
| `aliases` | Redirects to another service name. |
Expand All @@ -74,15 +77,19 @@ The ConfigProvider is automatically picked up by the framework during applicatio
2. **Read the configuration array** - A call similar to `$config = $container->get('config') ?? [];` reads an array of entries.
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.
4. **Handle errors** - The error-handling middleware is the last one in the pipeline, to make sure it can handle any exceptions.
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.
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.

Below you can see how Mezzio and Dotkernel merge and use ConfigProviders to build the middleware pipeline and dependencies.

![](/uploads/article/019f8a80-cc92-7277-92c8-c0e68d81615f/ConfigProvider2.png)

## Benefits

- **Centralized setup** - Instead of hardcoding bootstrap code, it's declared in a config provider so it's easy to read, change, or extend.
- **Modular** - Each package can ship with its own config without interfering with others.
- **Container-friendly** - Works well with frameworks using DI containers like Laminas ServiceManager, PHP-DI, or Pimple.
- **Standardized service definitions** - Consistent rules for object creation, separate from business logic.
- **Auto-Discovery** - In Laminas/Mezzio, the ConfigAggregator automatically loads and merges all ConfigProviders.
- **Auto-Discovery** - In Laminas/Mezzio, the [ConfigAggregator](https://docs.laminas.dev/laminas-config-aggregator/) automatically loads and merges all ConfigProviders.
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.
- **Environment-agnostic** - Returns an array that defines dev, test, or prod environments.
- **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).
Expand Down
28 changes: 17 additions & 11 deletions public/md-articles/best-practice/aptana-set-svn-keywords.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,37 @@ language: "en"

# Aptana - set SVN keywords

## Overview
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.

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

## Steps
1. In the file where you want to add the svn keyword property write **$Id$**

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

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.
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*

![](/uploads/article/019f8a80-cc86-73d9-a427-0621b2a55777/set-property-300x152.gif)

3. Select **svn:keywords**, and write **Id** in the text field

![](/uploads/article/019f8a80-cc86-73d9-a427-0621b2a55777/svn-keywords-300x298.gif)

When you make the SVN commit of the file, the *$Id$* keyword will be replaced with text in the format shown below:

![](/uploads/article/019f8a80-cc86-73d9-a427-0621b2a55777/id-file-svn-300x141.gif)

## FAQ

**Q: How do you set the svn:keywords property for a file in Aptana?**
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.
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.

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

**Q: What happens to the $Id$ keyword after an SVN commit?**
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.
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.

## Resources

Expand Down
Loading