<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by JuanDMeGon on Medium]]></title>
        <description><![CDATA[Stories by JuanDMeGon on Medium]]></description>
        <link>https://medium.com/@JuanDMeGon?source=rss-cd8a59d477a2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8MY04ui6RR-pwfitLbPDzw.png</url>
            <title>Stories by JuanDMeGon on Medium</title>
            <link>https://medium.com/@JuanDMeGon?source=rss-cd8a59d477a2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:06:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@JuanDMeGon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Starting with Laravel? What is the Best Way to Learn Laravel?]]></title>
            <link>https://blog.devgenius.io/starting-with-laravel-what-is-the-best-way-to-learn-laravel-d13afc51fa83?source=rss-cd8a59d477a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d13afc51fa83</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[learning-and-development]]></category>
            <dc:creator><![CDATA[JuanDMeGon]]></dc:creator>
            <pubDate>Tue, 02 Jun 2020 02:54:54 GMT</pubDate>
            <atom:updated>2020-08-19T19:39:39.944Z</atom:updated>
            <content:encoded><![CDATA[<h3>Starting with Laravel: What is the Best Way to Learn Laravel (or anything)?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-_L3X9E-PPcneyjw" /><figcaption>Photo by <a href="https://unsplash.com/@ffstop?utm_source=medium&amp;utm_medium=referral">Fotis Fotopoulos</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There exist multiple learning styles. So, initially, I would say that does not exist a unique and only way to learn something (including Laravel of course).</p><p>(<a href="https://twitter.com/JuanDMeGon">Follow me on Twitter</a> for tips and ideas on Laravel and Web Development)</p><p>I will start with the end. There is no “universal” way to learn Laravel (or anything) and it completely depends on you BUT there are, definitively, ways to NOT learn something, especially Laravel and programming related topics.</p><p>“Programming is learned by programming”, so if you want to learn Laravel, just start creating a project, right? Well… That is going to work in the long ride (eventually) and represents a good way to start but you will suffer maybe a little if you do not use a good approach.</p><p>The problem with just starting learning by doing is that you probably will kill yourself by creating a mega project with Laravel “just to learn”. That is even worst as you probably will finish doing the wrong things from the beginning (because you don’t know what you don’t know).</p><h3>So, how to learn Laravel?</h3><p>Well, effectively: create a project, but focus on Laravel, NOT in the project! Let me specify. To create a regular Laravel project you will need, at least:</p><ul><li>Routes</li><li>Models</li><li>Controllers</li><li>Views</li></ul><p>Of course, there is much much more, but let’s focus on the fundamental things at least.</p><p>If you want to learn Laravel by creating, for example, an eShop 😋, you will need routes: to create products, add products to cart, etc. correct? That is good. BUT… The focus should NOT be the routes for the eShop, it should be the routes itself, DOT.</p><p>Yes! If you learn to create the routes, you will create the routes for your eShop, BUT for your blog, and your portfolio and your admin panel and for, and for, and for… (you got it, right?).</p><p><strong>The recommendation?</strong> Start your project BUT focused on learning not in just finishing it AND follow the <a href="https://laravel.com/docs/master">documentation</a>, that is your holy grail.</p><p><strong>I know, the </strong><a href="https://laravel.com/docs/master"><strong>documentation</strong></a><strong> is huge! There should be another way, right? </strong>For sure, there are different ways. You can follow courses online, articles, videos, BUT be sure to follow those that are focused on your learning, in showing how the thinks work; NOT only how to create specific thinks without explaining the essentials.</p><p>Unfortunately, there exist tons and tons of resources focused on only showing how to create specific things directly to the solution, without showing the path and the process behind. Interestingly, those are the most consumed contents because those are reducing the pain, BUT, in the end, you won’t learn with enough depth and will be unsure of how to apply those “learnings” in different contexts.</p><h3>In conclusion:</h3><p>Find your path, but do not rush at all. Follow the <a href="https://laravel.com/docs/master">docs</a>, or articles, <a href="https://www.programarya.com/php-with-laravel-create-advanced-applications-while-learning-laravel">courses</a>, videos BUT be sure those are focused on the concepts and essences or at least focus your own on that!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkCMntvRvAoJmC_NJTVpVg.jpeg" /></figure><p>Finally, I am very aware of those differences on the good and not so good ways to learn Laravel, and I wanted to provide a solution. I created a <a href="https://www.programarya.com/php-with-laravel-create-advanced-applications-while-learning-laravel">course</a> on learning Laravel from scratch <em>focused on Laravel</em> and not only on creating something. Of course, I know, <em>creating something is important</em> as well, so you will see how to apply every of those Laravel’s features for an <a href="https://www.programarya.com/php-with-laravel-create-advanced-applications-while-learning-laravel">eShop project with Laravel</a>. Just <a href="https://www.programarya.com/php-with-laravel-create-advanced-applications-while-learning-laravel">take a look at the course</a> 😊.</p><p>Let me know your thoughts.</p><p>Best wishes and happy learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d13afc51fa83" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/starting-with-laravel-what-is-the-best-way-to-learn-laravel-d13afc51fa83">Starting with Laravel? What is the Best Way to Learn Laravel?</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Consume ANY HTTP service from Laravel: The good way]]></title>
            <link>https://blog.devgenius.io/consume-any-http-service-from-laravel-the-good-way-e523034e9ad0?source=rss-cd8a59d477a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e523034e9ad0</guid>
            <category><![CDATA[guzzle]]></category>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[http-client]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[JuanDMeGon]]></dc:creator>
            <pubDate>Tue, 27 Aug 2019 21:59:07 GMT</pubDate>
            <atom:updated>2020-08-19T19:41:21.501Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*du252cwtI_uwccYv" /><figcaption>Photo by <a href="https://unsplash.com/@seanlimm?utm_source=medium&amp;utm_medium=referral">Sean Lim</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There are tons of articles online explaining how to use GuzzleHTTP to consume HTTP services from any PHP project and of course from a Laravel project.</p><p>(<a href="https://twitter.com/JuanDMeGon">Follow me on Twitter</a> for tips and ideas on Laravel and Web Development)</p><p>Now, the major part of those articles show you how to create an instance of the Client class of Guzzle, send the request and obtain the response, something like this:</p><pre>use GuzzleHttp\Client;</pre><pre>$client = new Client([<br>    &#39;base_uri&#39; =&gt; $this-&gt;baseUri,<br>]);</pre><pre>$response = $client-&gt;request($method, $requestUrl, [<br>    &#39;query&#39; =&gt; $queryParams,<br>    &#39;form_params&#39; =&gt; $formParams,<br>    &#39;headers&#39; =&gt; $headers,<br>]);</pre><pre>$response = $response-&gt;getBody()-&gt;getContents();</pre><h3>The problem…</h3><figure><img alt="HTTP Clients with Laravel" src="https://cdn-images-1.medium.com/max/1024/1*V15GgN-s1iB4ZNVYTet8zg.jpeg" /></figure><p>Unfortunately, several of those articles just are focused on how to directly use GuzzleHTTP from any Laravel component (usually a Controller) and then return the response, but… What happens if you need to consume several services OR even when consumes the same service from different parts of your Laravel projects? Let’s say you need to consume a determined HTTP service from the action foo() of your BarController and then from the bar() of your FooController, and maybe from any specific model, service, etc.</p><p>So, after that, you may be finishing repeating calls to the Client class of GuzzleHTTP across your entire project, which may sound fine as GuzzleHTTP provides a good abstraction level for HTTP requests, BUT there is an even better way to adapt your calls to Client class and centralize that in your projects.</p><p>Basically, after all, what you need is to provide the capability to send HTTP requests to your project, to any URL with any HTTP method (POST, PUT, PATCH, DELETE, etc.), and, of course, with whatever body contents and even query parameters.</p><p>So, after developing several HTTP clients for clients, my side projects, and <a href="https://www.juandmegon.com/#courses">my courses</a>, I found that the traits in PHP are a very flexible solution to add the capability to consume any external service. In that way, any component of your project that uses this trait will be capable to send requests.</p><p>Finally, after this “introduction”, let me show you a proposal for a trait that should probably <strong>consume any kind of HTTP service</strong>, using Guzzle of course:</p><pre>namespace App\Traits;</pre><pre>use GuzzleHttp\Client;</pre><pre>trait ConsumesExternalServices<br>{<br>    /**<br>     * Send a request to any service<br>     * <a href="http://twitter.com/return">@return</a> string<br>     */<br>    public function makeRequest($method, $requestUrl, $queryParams = [], $formParams = [], $headers = [], $hasFile = false)<br>    {<br>        $client = new Client([<br>            &#39;base_uri&#39; =&gt; $this-&gt;baseUri,<br>        ]);</pre><pre>$bodyType = &#39;form_params&#39;;</pre><pre>if ($hasFile) {<br>            $bodyType = &#39;multipart&#39;;</pre><pre>$multipart = [];</pre><pre>foreach ($formParams as $name =&gt; $contents) {<br>                $multipart[] = [<br>                    &#39;name&#39; =&gt; $name,<br>                    &#39;contents&#39; =&gt; $contents<br>                ];<br>            }<br>        }</pre><pre>$response = $client-&gt;request($method, $requestUrl, [<br>            &#39;query&#39; =&gt; $queryParams,<br>            $bodyType =&gt; $hasFile ? $multipart : $formParams,<br>            &#39;headers&#39; =&gt; $headers,<br>        ]);</pre><pre>$response = $response-&gt;getBody()-&gt;getContents();</pre><pre>return $response;<br>    }<br>}</pre><p>Basically, you are generalizing the calls to the request() method of the Client class from Guzzle, allowing any HTTP method, any URL, and optionally, any query params, form params headers AND very important sending files.</p><p>Noticed that? YES nobody told you that sending files with GuzzleHTTP is slightly different than sending regular requests. You need to specify a multipart, instead of a form_params, and additionally, you need to format differently every field of the body, as all of them need a “name” and “content” values (that is why there is a foreach() there).</p><p>Now, once you have this trait, you can use it and call that from any component, let’s see a short example:</p><pre>namespace App\Services;</pre><pre>use App\Traits\ConsumesExternalServices;</pre><pre>class MyExternalService<br>{<br>    $baseUri = &#39;someUri&#39;;<br>    //Or better take that from the config() in the __construct()</pre><pre>use ConsumesExternalServices;</pre><pre>public function getUsers()<br>    {<br>        $this-&gt;makeRequest(&#39;GET&#39;, &#39;/users&#39;);<br>    }</pre><pre>public function createUser($data)<br>    {<br>        $this-&gt;makeRequest(&#39;POST&#39;, &#39;/users&#39;, [], $data);<br>    }<br>    ...<br>}</pre><p>So… did we finish already? Not so fast, there are some other things you can do to improve the scalability of your projects using this trait and be able to consume any service you need. For example, you may want to customize the way every service you consume resolves the authorization flow (sending a query param with a token? or sending an Authorization header with an access token? or something else?). Additionally, the way as the response is parsed after obtaining it (is it JSON? XML? plaintext? HTML?). <strong>I can help you</strong> to resolve that correctly, with this <a href="https://www.udemy.com/course/http-client-laravel-guzzle-requests-consume-apis-services/?couponCode=MEDIUM">course</a>.</p><p>By the way,<strong> I created a small </strong><a href="https://packagist.org/packages/juandmegon/http-client-tools"><strong>package</strong></a> to re-utilize this trait (and some other components) across all my projects, so you probably can do the same.</p><p>Finally, you may want to separate every service you consume in a Service class (or a set of services) where you can specify how to do a specific action (get users, get posts, publish something, etc.)</p><p>Now, there are several other things you need to resolve. So, <a href="https://www.programarya.com/http-client-laravel-guzzle-requests-consume-apis-services">let me help you</a> with that. I already show you a good way to go, but I can surely show you much more. Let me teach you how to integrate Laravel and Guzzle to consume any HTTP service. Let me show you how to create your <a href="https://www.programarya.com/http-client-laravel-guzzle-requests-consume-apis-services">HTTP Client with Laravel</a>.</p><p>We are done here. I hope you can find this useful for your projects and your career. If you are interested in any of my courses, here it is my <a href="https://www.juandmegon.com/#courses">portfolio</a>, or you can take directly the <a href="https://www.programarya.com/http-client-laravel-guzzle-requests-consume-apis-services">HTTP Clients</a> course.</p><p>Best wishes :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e523034e9ad0" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/consume-any-http-service-from-laravel-the-good-way-e523034e9ad0">Consume ANY HTTP service from Laravel: The good way</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A better way to learn and achieve your goals]]></title>
            <link>https://medium.com/@JuanDMeGon/a-better-way-to-learn-and-achieve-your-goals-2cb4d4f88bf3?source=rss-cd8a59d477a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cb4d4f88bf3</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[self-learning]]></category>
            <category><![CDATA[online-learning]]></category>
            <category><![CDATA[student-life]]></category>
            <dc:creator><![CDATA[JuanDMeGon]]></dc:creator>
            <pubDate>Fri, 12 Jan 2018 03:21:13 GMT</pubDate>
            <atom:updated>2020-08-21T01:58:56.968Z</atom:updated>
            <content:encoded><![CDATA[<p>I will tell you a short story and surely you will feel identified with it at any moment. If you feel anxious, you can go directly to the bone here, but I strongly recommend to first learn :), you will anyway enjoy the lecture.</p><p>(<a href="https://twitter.com/JuanDMeGon">Follow me on Twitter</a> for tips and ideas on Laravel and Web Development)</p><blockquote>“Albert decided he wanted to learn a new technology (let’s say build a JSON API with Laravel :D) which will allow him to improve his skills and be much more productive in his business, you know, centralize his projects data, and increase his projects and clients scalability.</blockquote><blockquote>What Albert did was search on the Internet about that new technology and found all sort of contents from several renowned authors: videos, tutorials, books, articles, video courses and similar.</blockquote><blockquote>At the end, Albert spent his money and time acquiring and reading several books, along with purchasing and watching other video courses.</blockquote><blockquote>After few weeks, Albert feels comfortable with all the new skills learned and immediately started a new project to put everything into practice and… The worst happened! Albert did not even know where to start, the only thing he could do was remember everything the renowned authors did on all their books and videos courses but did not know how to apply it for its own project.</blockquote><blockquote>After much trying, Albert finished reading the official documentation of that technology and reading specific questions and replies online to find his own way to implement the new project.”</blockquote><p>It seems like Albert spent his money and time trying to learn by others&#39; experiences, to then realize that, in the end, he is who must put hands in work to learn and understand everything on his own.</p><p>Probably, you felt like Albert so many times, did you?</p><p>I mean, you think you get the point and understand everything, and then realized you just understand how others do their stuff but you need to start a whole new process to learn and to apply all of that to your situations and requirements.</p><h3>The strength is in you</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cLATF4DhwLZSzY-93qHCCA.png" /></figure><p>That has been true for a long time. The best way to learn about programming is… PROGRAMMING so does not matter how many times you see that video or read that book; to learn and apply what you learned you have to do it on your own.</p><p>Clearly, the problem is not you trying to learn from others&#39; experiences, the problem is that others are trying to teach you based on their decisions and requirements. They did and decided everything for you instead of giving the path to follow, but let you decide what and how to do it.</p><p>Following that way, they (the teachers and instructors) should provide you a subtle guide, which puts you in the correct path but letting you decide how to walk through it, and especially, letting you decide how to customize it according to your goals.</p><p>Best wishes and happy learning!</p><p>PS: <a href="https://twitter.com/JuanDMeGon">Follow me on Twitter</a> to stay tuned with tips and ideas 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cb4d4f88bf3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>