Skip to content

Commit

Permalink
Updated grammar and suggested change
Browse files Browse the repository at this point in the history
  • Loading branch information
Isengo1989 committed Feb 26, 2024
1 parent 4207c3f commit 50118e3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions guides/plugins/plugins/framework/filesystem/filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ Flysystem is a file storage library for PHP. It provides one interface to intera

## Prerequisites

This guide is built upon both the [Plugin base guide](../../plugin-base-guide) as well as the [Add custom service guide](../../plugin-fundamentals/add-custom-service).
This guide is built upon both the [Plugin base guide](../../plugin-base-guide) and the [Add custom service guide](../../plugin-fundamentals/add-custom-service).

## Flysystem overview

The Flysystem enables your plugin to read and write files through a common interface. There are several default namespaces/directories that are available, for example:

* One for general private files of the shop: invoices, delivery notes
* One for general public files: product pictures, media files
* One for private files of the shop: invoices, delivery notes
* One for public files: product pictures, media files
* One for theme files
* One for sitemap files
* One for bundle assets files

However, every plugin/bundle gets an own namespace that should be used for private or public plugin files. These are automatically generated during the plugin installation. The namespace is prefixed with the [Snake case](https://en.wikipedia.org/wiki/Snake_case) plugin name followed by `filesystem` `.` `private` or `plugin`. For our example plugin this would be
However, every plugin/bundle gets an own namespace that should be used for private or public plugin files. These are automatically generated during the plugin installation. The namespace is prefixed with the [Snake case](https://en.wikipedia.org/wiki/Snake_case) plugin name followed by `filesystem` `.` `private` or `public`. For our example plugin, this would be

* `swag_example_plugin.filesystem.public` for public plugin files
* `swag_example_plugin.filesystem.private` for private plugin files
* `swag_basic_example.filesystem.public` for public plugin files
* `swag_basic_example.filesystem.private` for private plugin files

## Use filesystem in a service

To make use of the filesystem we register a new service, which helps to read and write files to the filesystem.
To make use of the filesystem, we register a new service, which helps to read and write files to the filesystem.

```php
// <plugin root>/src/Service/ExampleFilesystemService.php
Expand Down Expand Up @@ -78,7 +78,7 @@ class ExampleFilesystemService
}
```

This service makes use of the private und public filesystem of the plugin. As you already know, this php class has to be registered as a service in the dependency injection container. This is also the place where we define which filesystem will be handed over to the constructor. To make use of the plugin private and public files, the service definition could look like this:
This service makes use of the private und public filesystem. As you already know, this php class has to be registered as a service in the dependency injection container. This is also the place where we define which filesystem will be handed over to the constructor. To make use of the plugin private and public files, the service definition could look like this:

Check warning on line 81 in guides/plugins/plugins/framework/filesystem/filesystem.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/framework/filesystem/filesystem.md#L81

File types are normally capitalized. (FILE_EXTENSIONS_CASE[1]) Suggestions: `PHP` URL: https://languagetool.org/insights/post/spelling-capital-letters/ Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1 Category: CASING
Raw output
guides/plugins/plugins/framework/filesystem/filesystem.md:81:87: File types are normally capitalized. (FILE_EXTENSIONS_CASE[1])
 Suggestions: `PHP`
 URL: https://languagetool.org/insights/post/spelling-capital-letters/ 
 Rule: https://community.languagetool.org/rule/show/FILE_EXTENSIONS_CASE?lang=en-US&subId=1
 Category: CASING

```xml
// <plugin root>/src/Resources/config/services.xml
Expand All @@ -101,4 +101,4 @@ This service makes use of the private und public filesystem of the plugin. As yo
</container>
```

Now, this service can be used to read or write files to the private plugin filesystem or to list all files in the public plugin filesystem. You should visit the [Flysystem API documentation](https://flysystem.thephpleague.com/v1/docs/usage/filesystem-api/) for more information.
Now, this service can be used to read or write files to the private plugin filesystem or to list all files in the public plugin filesystem. You should visit the [Flysystem API documentation](https://flysystem.thephpleague.com/v1/docs/usage/filesystem-api/) for more information.

0 comments on commit 50118e3

Please sign in to comment.