<?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 Tiago Sousa on Medium]]></title>
        <description><![CDATA[Stories by Tiago Sousa on Medium]]></description>
        <link>https://medium.com/@tiagomichaelsousa?source=rss-b0d3f045696e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*ON1iLKHLyMsMJDxB_D2NPA.jpeg</url>
            <title>Stories by Tiago Sousa on Medium</title>
            <link>https://medium.com/@tiagomichaelsousa?source=rss-b0d3f045696e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:01:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tiagomichaelsousa/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[Quick Preview — cloudmobility Hackathon]]></title>
            <link>https://medium.com/@tiagomichaelsousa/quick-preview-cloudmobility-hackathon-99282031857e?source=rss-b0d3f045696e------2</link>
            <guid isPermaLink="false">https://medium.com/p/99282031857e</guid>
            <category><![CDATA[people]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[product]]></category>
            <dc:creator><![CDATA[Tiago Sousa]]></dc:creator>
            <pubDate>Thu, 15 Apr 2021 13:13:26 GMT</pubDate>
            <atom:updated>2021-04-15T13:13:26.233Z</atom:updated>
            <content:encoded><![CDATA[<h3>Quick Preview — cloudmobility Hackathon</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_PAZV2waX_TdBR43ZosQ0g.png" /></figure><h3><strong>Introduction</strong></h3><p>On the 4th and 5th of March, we had the first cloudmobility Hackathon! For those that don’t know what a Hackathon is, it’s an event where software engineers get together for some hours, days, or even weeks with the objective of discussing new ideas and implement them. In our case, it was just one day and a half, a total of 12 hours.</p><p>Of course, in order to be able to participate in such an event, you need an awesome team that was committed and aligned with the objectives of the Hackathon. In the IT world, it’s not difficult to find people that are really interested in building something from scratch in just a couple of hours, but we were able to create an awesome team that really wanted to see something rising that would improve the product and facilitate the life for the users. Such team was composed by <a href="https://medium.com/u/20f35677a9c4">David Alecrim</a>, <a href="https://medium.com/u/671768a618b5">Joni Oliveira</a> and <a href="https://medium.com/u/b0d3f045696e">Tiago Sousa</a>.</p><p>When we started the Hackathon, we already knew what we were about to develop since we had the opportunity to get together before to talk about what we thought could be a nice improvement for cloudmobility and for our clients.</p><p>After this discussion, we decided to develop <strong><em>Quick Preview</em></strong>. <em>Quick Preview</em> is an extension of the cloudmobility CLI that would allow the developers to quickly deploy an application based on its Dockerfile.</p><p>Nowadays it’s truly common to develop a new application using Docker to virtualize the environment (either development or others like production), so we based ourselves on the premise that this project would get a good amount of target audience.</p><h3>Getting our hands dirty</h3><p>The first hours of the event were mainly to decide what we should tackle first, prioritizing the tasks and splitting them across the team members. Shortly after we identified the requirements and tasks that were needed, each of the team members started to get their hands dirty.<br><a href="https://medium.com/u/b0d3f045696e">Tiago Sousa</a> started by extending the code base for the current cloudmobility CLI to add a new command, the <strong><em>cmy deploy create</em></strong> that would accept three parameters as flags:</p><ul><li><strong>Path</strong>: the path for the client kubeconfig file to connect to the namespace in cloudmobility;</li><li><strong>Namespace</strong>: the namespace id where the application would be deployed in cloudmobility;</li><li><strong>Repository</strong>: the user GitHub repository that would contain the code for the app and the docker file.</li></ul><p><a href="https://medium.com/u/20f35677a9c4">David Alecrim</a> started by creating a brand new React app with a Dockerfile that would export a default port where the application would be running and publish it in a GitHub Repository.</p><p><a href="https://medium.com/u/671768a618b5">Joni Oliveira</a> created a new API (built in go), that would be responsible for receiving all the parameters sent by the CLI and actually deploy the application in cloudmobility, using the helm client API.</p><h3>Main challenges</h3><p>The development of the Go API presented a few challenges in the development itself, but we could go around those.</p><p>The main problems we had in developing the solution were mainly around creating working helm charts for both:</p><ul><li>The Go API with which the cloudmobility CLI communicates;</li><li>The helm chart that deploys the user’s project (provided by the GitHub URL);</li><li>The helm chart that would deploy the go API in the cluster</li></ul><p>Since this was only a hackathon and the objective was to provide a functional prof of concept that would prove that our idea was feasible and a must for the users, there is a lot of room for improvement, for example:</p><ul><li>fetch applications for the most common repositories like GitLab, BitBucket, or others;</li><li>the <em>kubeconfig</em> wouldn&#39;t be needed to be passed as a parameter in the CLI since the Go API would be deployed in our management cluster;</li><li>let the user decide the URL where the application would be available since it was automatically generated as explained below.</li></ul><h3>Making it available</h3><p>By the end of the Hackathon, the team was able to achieve their goal and deploy an application that was in a public GitHub Repository with just one command through cloudmobility CLI with the following command:</p><pre>cmy deploy create <br>--path=“.kubeconfig” <br>--repository=https://github.com/... <br>--namespace=“namespace-id”</pre><p>To facilitate the user’s life even more, after the execution of the CLI command, the URL where the application would deployed, under cloudmobility infrastructure, was generated automatically based on the user repository name and it would be something like:</p><pre>https://quick-preview.cloud.eu1.cloudmobility.io</pre><h3>Conclusions</h3><p>These events are really great in a company since it allows everyone to contribute with new ideas for the product, and some of them are really useful as you may see in other blog posts that were or will be published. It also enforces the team union and improves communication and technical skills, by forcing the developers to get out of their comfort zone.</p><p>At <a href="https://cloudmobility.io/"><strong>cloudmobility</strong></a>, we believe, that there are no limits for people who are ready to prove themselves and are driven by what they believe in.</p><p>Our work ethic is built around diversity and constantly challenging ourselves to deliver the best products possible for our customers. If you are curious, check out our <a href="https://cloudmobility.io/career#open-positions">open positions</a> and <strong>come join our team</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99282031857e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[1 on 1  with Laravel package development]]></title>
            <link>https://medium.com/xgeeks/1-on-1-with-laravel-package-development-12de93953e?source=rss-b0d3f045696e------2</link>
            <guid isPermaLink="false">https://medium.com/p/12de93953e</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[package]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Tiago Sousa]]></dc:creator>
            <pubDate>Mon, 23 Mar 2020 15:26:51 GMT</pubDate>
            <atom:updated>2020-03-23T19:24:28.375Z</atom:updated>
            <content:encoded><![CDATA[<h3>1 on 1 with Laravel package development</h3><blockquote>This article was written for those who want to start developing packages for the Laravel community, but haven’t quite figured out how to start, what to do or how to do it. Here, I will explain how I developed one of my packages, and try to show you some tips and tricks I learned along the way that have helped me develop and maintain the code.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bLt9HaLHT_oYcrJP" /><figcaption>Photo by <a href="https://unsplash.com/@emilep?utm_source=medium&amp;utm_medium=referral">Émile Perron</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>First of all, if you want to develop a package, that’s probably because you are facing the same problem that you faced a few months ago or because you want to extract some code to use across multiple applications, at least for me that was the motivation that came across and the reason that I started writing packages. That’s a great initiative, in my personal opinion, and has a lot of pros.</p><p>The first package that I wrote came out when I was working on an internal project for the company that I work for and the problem was quite straightforward … I was always reproducing the same steps.</p><ul><li>Create the Migration</li><li>Create the Factory</li><li>Create the Model</li><li>Create the Seeder</li><li>Create the Controller</li><li>Create the API Resource and the Collection</li><li><em>Create the Request Validator</em></li><li><em>Create the Policy</em></li></ul><p>So I decided to automate the process and invest some time coding a speed up development package to improve all the artisan commands and boilerplate generated by them. And yes, that’s how <a href="https://github.com/tiagomichaelsousa/LaravelResources">Laravel Resources</a> came out.</p><h3>1. Introduction to the Inception</h3><p>The first thing that I did, before writing Laravel Resources, was taking a step back and of course, read carefully the <a href="https://getcomposer.org/doc/05-repositories.md">composer</a> and <a href="https://laravel.com/docs/7.x/packages">laravel documentation</a> (once again 😂) regarding package development and configuration. After that, I started to think, “well…. that’s a lot of configuration and boilerplate to start developing my first package! This should be automated as well”. It might sound ridiculous, but after this thought, I googled “laravel packager” and, guess what … the first result was a Laravel Package from <a href="https://github.com/Jeroen-G">Jeroen</a> to develop <a href="https://github.com/Jeroen-G/laravel-packager">Laravel packages</a>, crazy inception here.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7pHTiZYbAoq40%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Finception-7pHTiZYbAoq40&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F7pHTiZYbAoq40%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="300" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf05667cb7be14c89f4b791f759ca9b8/href">https://medium.com/media/cf05667cb7be14c89f4b791f759ca9b8/href</a></iframe><p>So I started by reading the documentation, as I always do before installing any package, and quickly came across the feeling “Dude, that’s insane …”. So I decided to give it a try and avoid “reinventing the wheel”.</p><h3>2. First things first, initial configuration</h3><p>After reading all the documentation that I needed to start coding my package I just used the magic artisan command available from Jeoren package.</p><pre>php artisan packager:new tiagomichaelsousa LaravelResources</pre><p>This command will create, in the root directory of your project, a package folder with all the boilerplate that you need to start coding your package. After this step, I normally update all the documentation that I already can, like license, composer.json file, code of conduct, how to contribute, etc. Don’t forget, you are publishing a package for the open source community, so documentation is a must!</p><p>In order to use a package you must pull it from composer so, from my shell I just typed:</p><pre>composer require tiagomichaelsousa/laravelresources --dev</pre><p>And boom, the magic happened 🧙🏻‍♂️ You can already use the package. But, how?! Well, when you use the packager command to create a new package it will update your application composer.json file and add the following lines out of the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*eoq6KtQzNlotGF4jJH_1ug.png" /></figure><p>These lines will allow you to add a package locally and you can interact directly with it like if it was published in <a href="https://packagist.org/">packagist</a>. What about if my package is already published in packagist and I want to add new features to it? I will cover that too, keep reading 😉</p><h3>3. Build something amazing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CMD8prkYFIkiUi-t5EzKVQ.png" /></figure><p>After the initial configuration, I was finally ready to write some php code 🎉. So I started to generate the artisan command that would be responsible for the creation of all the resources for a model.</p><p>Inside your package folder, you will find a <strong>ServiceProvider</strong> File. If you don’t know what is a service provider it&#39;s literally what it sounds! It provides a service to your app, allowing you to trigger some functionality from a component. If you are not comfortable with Service Providers I would recommend taking a look into <a href="https://laracasts.com/series/laravel-6-from-scratch/episodes/41">Service Providers</a> at <a href="https://laracasts.com/">Laracasts</a>.</p><p>At the bottom of your service provider file, you will find a <strong><em>bootForConsole()</em> </strong>method<strong> </strong>where you can add the path to your commands to make them available to the php artisan shell command.</p><p>I also like to add the path to the commands at the top of the service provider to immediately see the commands that the package will provide.</p><pre>private $commands = [</pre><pre>    ‘tiagomichaelsousa\LaravelResources\Commands\ResourceCommand’,</pre><pre>];</pre><p>And in the bootForConsole() method, I register the commands.</p><pre>$this-&gt;commands($this-&gt;commands);</pre><h3>4. Package functionality</h3><p>The artisan should receive the model name as a parameter and should be responsible for checking if the model already exists in the project. If the model wasn’t created yet it should ask if you want to create the migration, factory and the seeder by just saying <strong>yes</strong> or <strong>no. </strong>If you just press enter it will assume the answer as a <strong>yes</strong> and will create the resource.</p><p>After that, I decided to create a Class to start writing the code for the Controller. The implementation went really well and quickly I already had the package generating the controller with all the stubs that I needed so I started to write the code for the FormRequestValidator. As soon as I started to write the FormRequestValidator code I understood that the coded started to get the same structure. It should have a constructor to receive the model name that you had written in the shell, it should have a stub, it should have a replacement function for the stub, it should check if the file already exists and so on.</p><p>So once again <strong>I took a step back</strong> and decided to extract all these functions, that will be the same across all the generated resources, to an interface that I called Generator. Now every resource that was going to be created should implement all the functions present in the contract. Basic Object Oriented Programming 😉</p><p>After some time I had pretty much every features that I wanted for the package done and was really satisfied with the result! 🙌</p><h3>5. Testing? Hell yeees!</h3><blockquote>At this time, the package was ready to be published to the entire community and I was so hyped that I almost forgot that I didn’t even think about testing. Since it’s an open source project it’s really important to have tests for the core of your package! Imagine that a PR is submitted to add some feature to the core of the package and you just accepted because it was a really cool feature and the code looks pretty good. So far so good, but the developer that implemented the feature made a typo in the artisan command to generate the resources and you didn’t see it… Well, the package just died there because you didn’t even have a test to ensure the IO for your package. So yes, <strong>don’t write any code without tests.</strong></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7di2MFqB14AFO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffall-panda-rolling-7di2MFqB14AFO&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F7di2MFqB14AFO%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2972ebaf9c49e161ca0ffefa0e36dcd/href">https://medium.com/media/e2972ebaf9c49e161ca0ffefa0e36dcd/href</a></iframe><p>The packager command already boosts you with testing by adding out of the box the <strong>phpunit/phpunit</strong> and <strong>orchestra/testbench </strong>to your composer dependencies, so use it! Writing tests is not rocket science and nowadays it became so simple! The first thing you should do is create a TestCase class where you set the default behavior for every test. It should have a setup and a teardown function. The setup function will run before every test and the teardown function will run after each test.</p><p>After some time I already had all the test suites that I think I should have, but how could I be sure that I have good coverage for the entire package? So I used the phpunit command to execute my tests with the coverage flag.</p><pre>./vendor/bin/phpunit --coverage-html report</pre><p>This command will generate all the coverage report in HTML files, inside the report folder, for your test suite and you should add it to your .gitignore file since it’s not relevant for the features of the package.</p><p>And guess what …. so many tests that were missing 😃</p><p><strong>Note: </strong>if you don&#39;t know all the flags that a command has just use the --help flag!</p><p>To generate the test coverage you will need debug. You can just install it with pecl.</p><pre>pecl install xdebug</pre><h3>6. Make it live</h3><p>After a couple of days, I was finally ready to make the package available for the entire laravel community but, how does this works? Let me check the packager documentation and …. guess what?</p><pre>php artisan packager:publish tigomichaelsousa LaravelResources <a href="https://github.com/tiagomichaelsousa/LaravelResources">https://github.com/tiagomichaelsousa/LaravelResources</a></pre><p>Boom, everything published in a clean repo on GitHub 😉</p><p>But just the package in GitHub will not allow other developers to use it, you must publish it in packagist. To do so, you just need to login with your GitHub account in <a href="https://packagist.org/">packagist</a> and <a href="https://packagist.org/packages/submit">submit a form</a> with the link of your GitHub repository.</p><h3>7. Add new features to the package once submitted</h3><p>I submitted the package to packagist and decided to send it to <a href="https://laravel-news.com/">LaravelNews</a> in order for everyone to see and hopefully give me some feedback. After a couple of days, I wanted to make some changes to the core of the package but I wanted to have the same environment that I had when I was coding the package in the first hand, but suddenly a wild problem appeared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FRyKprWcF8DmAgwzrF6izQ.jpeg" /></figure><p>The package was already published to packagist and when I was trying to install it locally I was pulling the last version in packagist instead of the local copy that I had in my machine. It took me a while until I finally understood and solve this problem! The solution was pretty simple in fact, I just needed to add <strong>dev- </strong>before the branch in the composer.json file for your default laravel application.</p><pre>“tiagomichaelsousa/laravelresources”: “dev-master”</pre><p>Or you can require a default branch when you are running composer require:</p><pre>composer require tiagomichaelsousa/laravelresources “dev-master”</pre><p>After that, if you run composer install you will see in your shell a message saying the symlink between the package and the composer dependency was created based on your package path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VcbdXP9bq0NXBvONdM5M5g.jpeg" /></figure><h3>8. Final notes</h3><p>I used and I definitely recommend <a href="https://travis-ci.com/">TravisCI</a> integration for maintaining your packages. It’s definitely a must for these kinds of projects because when someone makes a PR it will automatically trigger the test suite and ensure that everything is fine with your code. Besides that, it will give you feedback directly in the PR if the tests are passing or failing!</p><p>Regarding the open source and the community itself, I would like to just say some words. When someone opens an issue in your repo, always try to see this as something that you can improve, not only in the code but in yourself. What I mean is, try to always see the critic as a constructive one instead of destructive. That’s how communities are built.</p><p>I hope you enjoyed reading this article and most importantly, I hope it will help you someday with your personal projects or even at work 🚀</p><p>If you found this article interesting, feel free to share it with your colleagues or friends, because you know … Sharing is caring!</p><p><strong>Also, if you enjoy working at a large scale in projects with global impact and if you enjoy a challenge, please reach out to us at </strong><a href="http://xgeeks.io/"><strong>xgeeks</strong></a><strong>! We’re always looking for talented people to join our team </strong>🙌</p><h3>Useful links and tips</h3><p><strong>Coday:</strong> Codacy is a static code analysis tool with metrics like Coverage, Duplication and Complexity. Also, it will generate cool badges to use in your readme file</p><p><a href="https://www.codacy.com/">Codacy - Code Quality and Security for Developers</a></p><p><strong>Poser:</strong> Poser allows you to add some pretty cool badges to your readme file</p><p><a href="https://poser.pugx.org/">Badge Poser</a></p><p><strong>All Contributors:</strong> All contributors allow to recognize your contributors and you must do it!</p><p><a href="https://allcontributors.org/">Recognize all contributors</a></p><p>And, of course, my GitHub account where I have the <a href="https://github.com/tiagomichaelsousa/LaravelResources">LaravelResources</a> and <a href="https://github.com/tiagomichaelsousa/LaravelFilters">LaravelFilters</a> packages source code.</p><p><a href="https://github.com/tiagomichaelsousa">tiagomichaelsousa - Overview</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12de93953e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/xgeeks/1-on-1-with-laravel-package-development-12de93953e">1 on 1  with Laravel package development</a> was originally published in <a href="https://medium.com/xgeeks">xgeeks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>