Re: [RFC] CSV Extension (ext/csv)
| From: | Damian Jóźwiak | Date: | Tue, 10 Nov 2026 17:00:58 +0000 |
| Subject: | Re: [RFC] CSV Extension (ext/csv) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-133065@lists.php.net to get a copy of this message | ||
On Tue, Nov 10, 2026 at 5:31 PM Juliette Reinders Folmer <
php-internals_nospam@adviesenzo.nl> wrote:
> On 10-11-2026 14:44, Damian Jóźwiak wrote:
>
> Hi Ignace,
>
> Thanks for the suggestion. I agree that a dedicated interface for
> converting objects into CSV fields could be useful.
>
> I'd prefer to avoid the term "serialization", as I've deliberately used
> "conversion" throughout the RFC. Something like Csv\FieldConvertible with
> a toCsvField() method would be more consistent with that terminology.
>
> There is one thing I'd like to consider before introducing it, though.
>
> The last item in the RFC's Future Scope section already mentions the
> possibility of an object-oriented API. I think a dedicated conversion
> interface would fit quite naturally into such an API.
>
> With the current function-based API, callers can already explicitly invoke
> their own conversion methods before passing values to the CSV functions:
>
> Csv\array_to_row([
> $object->toCsvField(),
> ]);
>
> This provides explicit control over the CSV representation without
> requiring a new interface in the initial API.
>
> So the question, in my view, is whether we really need to introduce a
> dedicated interface now, or whether it would be better to revisit it
> alongside the potential object-oriented API, where its role and integration
> could be considered more broadly.
>
> I'm not opposed to the interface itself. I'd just prefer to avoid
> expanding the initial scope unless there's a compelling use case that the
> existing functions cannot reasonably accommodate.
>
> Best regards,
> Damian
>
>
> Damian,
>
> Please respect the mailing list rules [1] and always reply with a
> bottom-post. This conversation as it is currently, is impossible to follow
> with Ignace (correctly) bottom posting and you consistently incorrectly
> top-posting.
>
> Smile,
> Juliette
>
> 1:
> https://github.com/php/php-src/blob/master/docs/mailinglist-rules.md
>
> Sorry about that, Juliette. I'll make sure to bottom-post from now on.