I have a group of Serializer classes that I want to put under a namespace. How would I call those classes and their filenames according to PSR?
Should I have:
/Serializer
Markdown.php (class Markdown)
Json.php (class Json)
Html.php (class Html)
Vendor\Package\Serializer\Markdown
or
/Serializer
MarkdownSerializer.php (class MarkdownSerializer)
JsonSerializer.php (class JsonSerializer)
HtmlSerializer.php (class HtmlSerializer)
Vendor\Package\Serializer\MarkdownSerializer
Should the namespace and folder name be plural, i.e. "Serializers"?
How should I capitalize JSON -
JsonSerializer
orJSONSerializer
I guess suffixing files with Serializer
is better because if I have a base class Serializer.php
that others extend, they would be called FooSerializer.php
and it would make sense. Otherwise, if I have a base class, how would I call it? If I have Serializer.php
and Markdown.php
, nothing would indicate that one extends the other in any way.