<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mathias</title>
    <description>The latest articles on Forem by Mathias (@mathias_berg_47c9d33ef290).</description>
    <link>https://forem.com/mathias_berg_47c9d33ef290</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3580612%2F1973c695-d428-4103-91a2-951d03f6d84e.jpg</url>
      <title>Forem: Mathias</title>
      <link>https://forem.com/mathias_berg_47c9d33ef290</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mathias_berg_47c9d33ef290"/>
    <language>en</language>
    <item>
      <title>After years - Back to open source</title>
      <dc:creator>Mathias</dc:creator>
      <pubDate>Thu, 23 Oct 2025 19:21:12 +0000</pubDate>
      <link>https://forem.com/mathias_berg_47c9d33ef290/after-years-back-to-open-source-1ib4</link>
      <guid>https://forem.com/mathias_berg_47c9d33ef290/after-years-back-to-open-source-1ib4</guid>
      <description>&lt;h1&gt;
  
  
  🧩 Back to Open Source: Flexible Data Mapping with &lt;code&gt;event4u/data-helpers&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;After several years working exclusively in startup environments, focusing on product‑driven internal development, I’ve finally found the time and motivation to return to the Open Source community.&lt;/p&gt;

&lt;p&gt;To mark this shift, I’ve revived and rebuilt an old idea of mine: a lightweight PHP package that solves a common but often underestimated challenge — &lt;strong&gt;accessing and transforming deeply nested data&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Whether you're dealing with messy API responses, preparing clean outputs, or mapping between different internal structures — this package helps you extract and restructure data in a clear and consistent way.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 What does the package do?
&lt;/h2&gt;

&lt;p&gt;The main goal of &lt;a href="https://event4u-app.github.io/data-helpers/" rel="noopener noreferrer"&gt;event4u/data-helpers&lt;/a&gt; is to simplify &lt;strong&gt;access&lt;/strong&gt;, &lt;strong&gt;mutation&lt;/strong&gt; and &lt;strong&gt;mapping&lt;/strong&gt; of structured data using dot notation and wildcards.&lt;/p&gt;

&lt;p&gt;It’s framework‑agnostic and works well with Laravel, Symfony, or any plain PHP app.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key features:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🔍 Dot notation access with support for wildcards (&lt;code&gt;*&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;🛠️ Helpers to map or mutate data structures&lt;/li&gt;
&lt;li&gt;♻️ Reusable mapping definitions&lt;/li&gt;
&lt;li&gt;✅ Type-safe, predictable, and testable transformations&lt;/li&gt;
&lt;li&gt;🧩 Especially useful for APIs, DTOs, imports and exports&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💡 Code Example
&lt;/h2&gt;

&lt;p&gt;Say you get a messy API response like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// From this messy API response...&lt;/span&gt;
&lt;span class="nv"&gt;$apiResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'data'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'departments'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'users'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="s1"&gt;'email'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'alice@example.com'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'email'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'bob@example.com'&lt;/span&gt;&lt;span class="p"&gt;]]],&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'users'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="s1"&gt;'email'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'charlie@example.com'&lt;/span&gt;&lt;span class="p"&gt;]]],&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// ...to this clean result in one line&lt;/span&gt;
&lt;span class="nv"&gt;$accessor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DataAccessor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$apiResponse&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$emails&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$accessor&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'data.departments.*.users.*.email'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Result: ['alice@example.com', 'bob@example.com', 'charlie@example.com']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use the &lt;code&gt;Mapper&lt;/code&gt; class to define reusable transformations with default values, custom logic, and support for bidirectional mapping (e.g., for transforming requests and responses).&lt;/p&gt;




&lt;h2&gt;
  
  
  🤝 Looking for Feedback
&lt;/h2&gt;

&lt;p&gt;This is just the beginning — the package already supports many advanced use cases, but I’m actively looking for ideas to improve it further.&lt;/p&gt;

&lt;p&gt;If you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;have ideas for features or syntax improvements&lt;/li&gt;
&lt;li&gt;encounter edge‑cases or bugs&lt;/li&gt;
&lt;li&gt;use it in a real PHP project and would like to share your experience&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…I’d &lt;strong&gt;love to hear from you&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;👉 GitHub: &lt;a href="https://github.com/event4u-app/data-helpers" rel="noopener noreferrer"&gt;https://github.com/event4u-app/data-helpers&lt;/a&gt;&lt;br&gt;
📚 Docs: &lt;a href="https://event4u-app.github.io/data-helpers" rel="noopener noreferrer"&gt;https://event4u-app.github.io/data-helpers&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Thanks for reading — I’m excited to contribute back to the open source community again!&lt;/p&gt;

&lt;p&gt;Let me know what you think in the comments 💬&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>symfony</category>
      <category>github</category>
    </item>
  </channel>
</rss>
