You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>This plugin is already integrated into the Satellite package, so you can’t require it with the composer.</p>
708
715
<h2id="usage">Usage</h2>
709
716
<p>Unlike other plugins, the configuration is the same whether it is an extractor, a transformer or a loader.</p>
710
-
<p>First you need to <ahref="../../feature/services">determine your services</a> in your pipeline or workflow and then use the <code>use</code>
711
-
option which allows you to define which service to use.</p>
712
717
<h3id="building-an-extractor">Building an extractor</h3>
718
+
<p>In the example given, we explain how to configure a custom extractor with the <code>Bar</code> class located in the <code>App\Class</code> namespace.</p>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">use</span>: <spanstyle="color:#e6db74">'App\Class\Bar'</span><spanstyle="color:#75715e"># This line specifies the extractor class you want to use.</span>
</span></span></code></pre></div><h3id="building-a-transformer">Building a transformer</h3>
724
+
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">App\Class\Bar: ~ # Here, we declare the service associated with the Bar class with the syntax App\Class\Bar</span>: <spanstyle="color:#ae81ff">~. This simply indicates that we want to use the default parameters for this service.</span>
725
+
</span></span></code></pre></div><p>For more details about service configurations, please visit the <ahref="../../feature/services">declaring-services</a> documentation.</p>
726
+
<h3id="building-a-transformer">Building a transformer</h3>
727
+
<p>In the example given, we explain how to configure a custom extractor with the <code>Bar</code> class located in the <code>App\Class</code> namespace.</p>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">use</span>: <spanstyle="color:#e6db74">'App\Class\Bar'</span><spanstyle="color:#75715e"># This line specifies the extractor class you want to use.</span>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">App\Class\Bar</span>:<spanstyle="color:#75715e"># Here, we declare the service associated with the Bar class.</span>
734
+
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">factory</span>: <spanstyle="color:#75715e"># This section indicates that the service must be created by calling the extract method of the App\Class\Bar class.</span>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">arguments</span>:<spanstyle="color:#75715e"># The arguments to be passed to the extract method. In this example, the @foo symbol indicates that the foo service should be injected as an argument. Make sure that the foo service is configured correctly elsewhere in your pipeline.</span>
</span></span></code></pre></div><p>For more details about service configurations, please visit the <ahref="../../feature/services">declaring-services</a> documentation.</p>
741
+
<h3id="building-a-loader">Building a loader</h3>
742
+
<p>In the example given, we explain how to configure a custom extractor with the <code>Bar</code> class located in the <code>App\Class</code> namespace.</p>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">use</span>: <spanstyle="color:#e6db74">'App\Class\Bar'</span><spanstyle="color:#75715e"># This line specifies the extractor class you want to use.</span>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">App\Class\Bar</span>: <spanstyle="color:#75715e"># Here, we declare the service associated with the Bar class.</span>
749
+
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">calls</span>: <spanstyle="color:#75715e"># This section indicates that specific method calls must be made to the service instance.</span>
750
+
</span></span><spanstyle="display:flex;"><span> - <spanstyle="color:#f92672">withUsername</span>: [ <spanstyle="color:#e6db74">'admin'</span> ] <spanstyle="color:#75715e"># This means that a method call named withUsername must be made to the instance of the Bar class, with the username "admin" passed as an argument.</span>
751
+
</span></span></code></pre></div><p>For more details about service configurations, please visit the <ahref="../../feature/services">declaring-services</a> documentation.</p>
752
+
</div>
738
753
739
754
<pclass="post-meta border-bottom pb-3 mb-0 mt-3">Updated on 22 Jan 2021</p>
<li><code>offset</code>, starts the request at the chosen index, by default we have 0.</li>
845
+
<li><code>length</code>, defines a batch length, by default we have 200.</li>
846
+
</ul>
847
+
<p>Here we have set an offset to 0 and a length to 150, it means we are starting the request from the first element and make multiple requests with 150 items max.</p>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">path</span>: <spanstyle="color:#ae81ff">../build</span><spanstyle="color:#75715e"># path to the build directory, relative to the YAML file</span>
</span></span></code></pre></div><h4id="add-custom-code-without-a-composer-package">Add custom code without a Composer package</h4>
510
+
<p>Sometimes you need to use a custom class but you can’t add a composer package, or creating this package is a disproportional effort. In this cas you have the <code>copy</code> options under the adapter.</p>
511
+
<p>Supported by <ahref="#using-docker-">Docker</a> and <ahref="#using-the-file-system">Filesystem</a> adapters.</p>
512
+
<p>The build will copy files you list. If you use a class with a namespace, you will need to add the namespace to the <ahref="#autoload">autoloading</a> specification.</p>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">path</span>: <spanstyle="color:#ae81ff">../build</span><spanstyle="color:#75715e"># path to the build directory, relative to the YAML file</span>
<p>It’s possible to declare the Composer dependencies, autoloads, repositories and auths that our microservice needs with the <code>composer</code> key.</p>
511
539
<p>If you instead wish to use your own <code>composer.json</code> to define the requirements and autoloads, set the option <code>from_local</code> to <code>true</code>, and jump to <ahref="#setting-up-the-runtime">the next chapter</a>.
0 commit comments