<?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 Felix Lehmann on Medium]]></title>
        <description><![CDATA[Stories by Felix Lehmann on Medium]]></description>
        <link>https://medium.com/@felixlehmann_74058?source=rss-63aad9f06ae8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*x4w8-NBm2XOWpWjQ.</url>
            <title>Stories by Felix Lehmann on Medium</title>
            <link>https://medium.com/@felixlehmann_74058?source=rss-63aad9f06ae8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:44:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@felixlehmann_74058/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[Stop worrying about missing API sunsets — use free notifications — Part II]]></title>
            <link>https://medium.com/@felixlehmann_74058/stop-worrying-about-missing-api-sunsets-use-free-notifications-part-ii-b8ba7c943da4?source=rss-63aad9f06ae8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8ba7c943da4</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[api-management]]></category>
            <dc:creator><![CDATA[Felix Lehmann]]></dc:creator>
            <pubDate>Fri, 18 May 2018 09:51:28 GMT</pubDate>
            <atom:updated>2018-05-18T09:54:08.698Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EunmtyM90qT04Smf." /><figcaption>Photo by <a href="https://unsplash.com/@askkell?utm_source=medium&amp;utm_medium=referral">Andy Kelly</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><a href="https://medium.com/@felixlehmann_74058/stop-worrying-about-missing-api-sunsets-start-to-use-an-api-for-this-now-1fbbc1f1ad5b">Part I of this article</a> described how to use an API to monitor deprecations of APIs.</p><p><strong>There’s a free service</strong></p><p>So what’s easier than implementing your own solution for monitoring deprecations? Use an existing service.</p><p>With inger.io you can simply select the APIs you’re using and you will get curated email notifications 90, 60 and 30 days before the API version expires. Enough time to schedule an update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*0BqpjteNupCGG2g5-cPZbg.png" /></figure><p><strong>Acknowledgement</strong></p><p>There’s a high chance that you’re looking for a vendor who’s not in the list, yet. In this case please simply send an email to hello@inger.io and if possible, add a link to the page or a contact where the sunset dates can be retrieved.</p><p><strong>Feedback</strong></p><p>If you like, please share this post. If you don’t like it, please let me know.</p><p><strong>Sitemap</strong></p><ol><li><a href="https://medium.com/@felixlehmann_74058/stop-worrying-about-missing-api-sunsets-start-to-use-an-api-for-this-now-1fbbc1f1ad5b">Stop worrying about missing API sunsets — manual — Part I</a></li><li><a href="https://medium.com/@felixlehmann_74058/stop-worrying-about-missing-api-sunsets-use-free-notifications-part-ii-b8ba7c943da4">Stop worrying about missing API sunsets — automated — Part II</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8ba7c943da4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop worrying about missing API sunsets — start to use an API for this now — Part I]]></title>
            <link>https://medium.com/@felixlehmann_74058/stop-worrying-about-missing-api-sunsets-start-to-use-an-api-for-this-now-1fbbc1f1ad5b?source=rss-63aad9f06ae8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fbbc1f1ad5b</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[api-integration]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[api-management]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Felix Lehmann]]></dc:creator>
            <pubDate>Tue, 27 Mar 2018 15:46:42 GMT</pubDate>
            <atom:updated>2018-05-18T09:52:55.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nH6znDk-tjDZZIWxa2XZ8w.jpeg" /><figcaption>Stop being sad about missed API sunset dates.</figcaption></figure><p>If you’re interested in an automated solution — please read <a href="https://medium.com/@felixlehmann_74058/stop-worrying-about-missing-api-sunsets-use-free-notifications-part-ii-b8ba7c943da4">part II</a>.</p><p>Don’t be sad. Tackle the problem now.</p><p>The following text will be straight to the point without much lyrical decoration.</p><p><strong>Problem</strong></p><p>As a [insert your position here], you probably consumed an web api before. Either from a major vendor like <em>facebook</em> and their <em>graph api </em>or from a smaller player.<br>These apis usually are versioned. Like the current version of the <em>facebook graph api</em> is <em>v2.12</em>. The previous version is <em>v2.11</em> and it will be available until 2020–01–30.<br>If you use <em>v2.11</em> and don’t track the sunset (end of life) date, you will probably wonder in two years what’s going on:<br><em>- You missed the deprecation date, again.<br>- Your implementation refuses to work.<br>- Your app reputation drops, you and your customers are unhappy.<br>- You update in panic mode and hope that I will work out.<br>- And you promise to yourself that it will never happen again.</em><br> But tracking these dates manually for all of your apis can be time consuming and is a unnecessary task to do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*qckD3GRn3kRy5Fw4CzXwSg.gif" /><figcaption>So what now?</figcaption></figure><p><strong>Solution</strong></p><p>It’s simple: <em>Use a central API that provides all the sunset dates of the other APIs!</em><br>This way you can keep track of all the dates in an automated way and get notified like one, three or six months before the apis’ lifetime ends.<br>And you can properly plan for it, schedule it in a sprint for development and exhaustive testing.<br>There’s a free API for this: <a href="https://inger.io/">https://inger.io</a> (even on <a href="https://twitter.com/ingerOfficial">twitter</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*y5P-MVkI66TJkwdNG9Cvkg.gif" /></figure><p><strong>How does it look in practise?</strong></p><p>So for example for the facebook graph api version v2.11 it would be:</p><p><a href="https://inger.io//v1/%7Bvendor%7D/%7Bservice%7D/%7Bversion%7D/%7Bdeprecated|published%7D">https://inger.io/v1/facebook/graph/v2.11/deprecated</a></p><p>How does the pattern look like?</p><p><a href="https://inger.io//v1/%7Bvendor%7D/%7Bservice%7D/%7Bversion%7D/%7Bdeprecated|published%7D">https://inger.io/v1/{vendor}/{service}/{version}/{deprecated|published}</a></p><p>Placeholders:</p><p>{inger_version} Inger.io API Version. v1 is the current one</p><p>{vendor} Vendorname like facebook, google, microsoft</p><p>{api} Apiname like graph, for the facebook graph api</p><p>{version} Apiversion like v2.5, for the graph api of facebook</p><p>{method} Either “deprecated” or “published”, to get the deprecation date or published date</p><p>Implementation examples to query the deprecation dates for multiple apis at the same time can be found on <a href="https://github.com/felixlehmann?tab=repositories&amp;q=inger">github</a> (where the PHP example is the most advanced one).</p><p><strong>But I just want to get notified without having to implement a consumer for the API by myself!?</strong></p><p>That’s reasonable. An additional service subscribing by email, choosing apis and when to get notified, is in the making.</p><p><strong>Acknowledgement</strong></p><p>There’s a high chance that you’re looking for a vendor who’s not in the list, yet. In this case please simply send an email to hello@inger.io and if possible, add a link to the page or a contact where the sunset dates can be retrieved.</p><p><strong>Feedback</strong></p><p>If you like, please share this post. If you don’t like it, please let me know.</p><p><strong>Sitemap</strong></p><ol><li><a href="https://medium.com/@felixlehmann_74058/stop-worrying-about-missing-api-sunsets-start-to-use-an-api-for-this-now-1fbbc1f1ad5b">Stop worrying about missing API sunsets — manual — Part I</a></li><li><a href="https://medium.com/@felixlehmann_74058/stop-worrying-about-missing-api-sunsets-use-free-notifications-part-ii-b8ba7c943da4">Stop worrying about missing API sunsets — automated — Part II</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fbbc1f1ad5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Facebook Ad Country Code List]]></title>
            <link>https://medium.com/@felixlehmann_74058/facebook-ad-country-code-list-14bb131bd01d?source=rss-63aad9f06ae8------2</link>
            <guid isPermaLink="false">https://medium.com/p/14bb131bd01d</guid>
            <category><![CDATA[facebook-developer]]></category>
            <category><![CDATA[facebook-ads]]></category>
            <category><![CDATA[facebook-api]]></category>
            <category><![CDATA[facebook]]></category>
            <category><![CDATA[facebook-advertising]]></category>
            <dc:creator><![CDATA[Felix Lehmann]]></dc:creator>
            <pubDate>Mon, 04 Dec 2017 10:54:35 GMT</pubDate>
            <atom:updated>2017-12-04T10:54:35.420Z</atom:updated>
            <content:encoded><![CDATA[<p>I was always searching for a complete list of supported countries by the Facebook API.</p><p>Now I finally found an API endpoint to get all the countries (be aware of the paging you have to do).</p><p>Either use the Graph API Explorer and use:</p><pre>search?type=adgeolocation&amp;location_types=[‘country’]</pre><p>Or as a CURL command:</p><pre>curl -i -X GET \<br> &quot;https://graph.facebook.com/v2.11/search?type=adgeolocation&amp;location_types=%5B&#39;country&#39;%5D</pre><p>Hope it helps you.</p><p>Here’s the full list:</p><pre>{<br>  &quot;data&quot;: [<br>    {<br>      &quot;name&quot;: &quot;Andorra&quot;,<br>      &quot;country_code&quot;: &quot;AD&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;United Arab Emirates&quot;,<br>      &quot;country_code&quot;: &quot;AE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Afghanistan&quot;,<br>      &quot;country_code&quot;: &quot;AF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Antigua&quot;,<br>      &quot;country_code&quot;: &quot;AG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Anguilla&quot;,<br>      &quot;country_code&quot;: &quot;AI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Albania&quot;,<br>      &quot;country_code&quot;: &quot;AL&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Armenia&quot;,<br>      &quot;country_code&quot;: &quot;AM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Netherlands Antilles&quot;,<br>      &quot;country_code&quot;: &quot;AN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Angola&quot;,<br>      &quot;country_code&quot;: &quot;AO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Antarctica&quot;,<br>      &quot;country_code&quot;: &quot;AQ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Argentina&quot;,<br>      &quot;country_code&quot;: &quot;AR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;American Samoa&quot;,<br>      &quot;country_code&quot;: &quot;AS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Austria&quot;,<br>      &quot;country_code&quot;: &quot;AT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Australia&quot;,<br>      &quot;country_code&quot;: &quot;AU&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Aruba&quot;,<br>      &quot;country_code&quot;: &quot;AW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Aland Islands&quot;,<br>      &quot;country_code&quot;: &quot;AX&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Azerbaijan&quot;,<br>      &quot;country_code&quot;: &quot;AZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bosnia and Herzegovina&quot;,<br>      &quot;country_code&quot;: &quot;BA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Barbados&quot;,<br>      &quot;country_code&quot;: &quot;BB&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bangladesh&quot;,<br>      &quot;country_code&quot;: &quot;BD&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Belgium&quot;,<br>      &quot;country_code&quot;: &quot;BE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Burkina Faso&quot;,<br>      &quot;country_code&quot;: &quot;BF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bulgaria&quot;,<br>      &quot;country_code&quot;: &quot;BG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bahrain&quot;,<br>      &quot;country_code&quot;: &quot;BH&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Burundi&quot;,<br>      &quot;country_code&quot;: &quot;BI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Benin&quot;,<br>      &quot;country_code&quot;: &quot;BJ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Saint Barthélemy&quot;,<br>      &quot;country_code&quot;: &quot;BL&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bermuda&quot;,<br>      &quot;country_code&quot;: &quot;BM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Brunei&quot;,<br>      &quot;country_code&quot;: &quot;BN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bolivia&quot;,<br>      &quot;country_code&quot;: &quot;BO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bonaire, Sint Eustatius and Saba&quot;,<br>      &quot;country_code&quot;: &quot;BQ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Brazil&quot;,<br>      &quot;country_code&quot;: &quot;BR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;The Bahamas&quot;,<br>      &quot;country_code&quot;: &quot;BS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bhutan&quot;,<br>      &quot;country_code&quot;: &quot;BT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Bouvet Island&quot;,<br>      &quot;country_code&quot;: &quot;BV&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Botswana&quot;,<br>      &quot;country_code&quot;: &quot;BW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Belarus&quot;,<br>      &quot;country_code&quot;: &quot;BY&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Belize&quot;,<br>      &quot;country_code&quot;: &quot;BZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Canada&quot;,<br>      &quot;country_code&quot;: &quot;CA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Cocos (Keeling) Islands&quot;,<br>      &quot;country_code&quot;: &quot;CC&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Democratic Republic of the Congo&quot;,<br>      &quot;country_code&quot;: &quot;CD&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Central African Republic&quot;,<br>      &quot;country_code&quot;: &quot;CF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Republic of the Congo&quot;,<br>      &quot;country_code&quot;: &quot;CG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Switzerland&quot;,<br>      &quot;country_code&quot;: &quot;CH&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Côte d&#39;Ivoire&quot;,<br>      &quot;country_code&quot;: &quot;CI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Cook Islands&quot;,<br>      &quot;country_code&quot;: &quot;CK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Chile&quot;,<br>      &quot;country_code&quot;: &quot;CL&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Cameroon&quot;,<br>      &quot;country_code&quot;: &quot;CM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;China&quot;,<br>      &quot;country_code&quot;: &quot;CN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Colombia&quot;,<br>      &quot;country_code&quot;: &quot;CO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Costa Rica&quot;,<br>      &quot;country_code&quot;: &quot;CR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Cape Verde&quot;,<br>      &quot;country_code&quot;: &quot;CV&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Curaçao&quot;,<br>      &quot;country_code&quot;: &quot;CW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Christmas Island&quot;,<br>      &quot;country_code&quot;: &quot;CX&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Cyprus&quot;,<br>      &quot;country_code&quot;: &quot;CY&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Czech Republic&quot;,<br>      &quot;country_code&quot;: &quot;CZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Germany&quot;,<br>      &quot;country_code&quot;: &quot;DE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Djibouti&quot;,<br>      &quot;country_code&quot;: &quot;DJ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Denmark&quot;,<br>      &quot;country_code&quot;: &quot;DK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Dominica&quot;,<br>      &quot;country_code&quot;: &quot;DM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Dominican Republic&quot;,<br>      &quot;country_code&quot;: &quot;DO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Algeria&quot;,<br>      &quot;country_code&quot;: &quot;DZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Ecuador&quot;,<br>      &quot;country_code&quot;: &quot;EC&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Estonia&quot;,<br>      &quot;country_code&quot;: &quot;EE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Egypt&quot;,<br>      &quot;country_code&quot;: &quot;EG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Western Sahara&quot;,<br>      &quot;country_code&quot;: &quot;EH&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Eritrea&quot;,<br>      &quot;country_code&quot;: &quot;ER&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Spain&quot;,<br>      &quot;country_code&quot;: &quot;ES&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Ethiopia&quot;,<br>      &quot;country_code&quot;: &quot;ET&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Finland&quot;,<br>      &quot;country_code&quot;: &quot;FI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Fiji&quot;,<br>      &quot;country_code&quot;: &quot;FJ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Falkland Islands&quot;,<br>      &quot;country_code&quot;: &quot;FK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Federated States of Micronesia&quot;,<br>      &quot;country_code&quot;: &quot;FM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Faroe Islands&quot;,<br>      &quot;country_code&quot;: &quot;FO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;France&quot;,<br>      &quot;country_code&quot;: &quot;FR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Gabon&quot;,<br>      &quot;country_code&quot;: &quot;GA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;United Kingdom&quot;,<br>      &quot;country_code&quot;: &quot;GB&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Grenada&quot;,<br>      &quot;country_code&quot;: &quot;GD&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Georgia&quot;,<br>      &quot;country_code&quot;: &quot;GE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;French Guiana&quot;,<br>      &quot;country_code&quot;: &quot;GF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Guernsey&quot;,<br>      &quot;country_code&quot;: &quot;GG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Ghana&quot;,<br>      &quot;country_code&quot;: &quot;GH&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Gibraltar&quot;,<br>      &quot;country_code&quot;: &quot;GI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Greenland&quot;,<br>      &quot;country_code&quot;: &quot;GL&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;The Gambia&quot;,<br>      &quot;country_code&quot;: &quot;GM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Guinea&quot;,<br>      &quot;country_code&quot;: &quot;GN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Guadeloupe&quot;,<br>      &quot;country_code&quot;: &quot;GP&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Equatorial Guinea&quot;,<br>      &quot;country_code&quot;: &quot;GQ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Greece&quot;,<br>      &quot;country_code&quot;: &quot;GR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;South Georgia and the South Sandwich Islands&quot;,<br>      &quot;country_code&quot;: &quot;GS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Guatemala&quot;,<br>      &quot;country_code&quot;: &quot;GT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Guam&quot;,<br>      &quot;country_code&quot;: &quot;GU&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Guinea-Bissau&quot;,<br>      &quot;country_code&quot;: &quot;GW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Guyana&quot;,<br>      &quot;country_code&quot;: &quot;GY&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Hong Kong&quot;,<br>      &quot;country_code&quot;: &quot;HK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Heard Island and McDonald Islands&quot;,<br>      &quot;country_code&quot;: &quot;HM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Honduras&quot;,<br>      &quot;country_code&quot;: &quot;HN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Croatia&quot;,<br>      &quot;country_code&quot;: &quot;HR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Haiti&quot;,<br>      &quot;country_code&quot;: &quot;HT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Hungary&quot;,<br>      &quot;country_code&quot;: &quot;HU&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Indonesia&quot;,<br>      &quot;country_code&quot;: &quot;ID&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Ireland&quot;,<br>      &quot;country_code&quot;: &quot;IE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Israel&quot;,<br>      &quot;country_code&quot;: &quot;IL&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Isle Of Man&quot;,<br>      &quot;country_code&quot;: &quot;IM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;India&quot;,<br>      &quot;country_code&quot;: &quot;IN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;British Indian Ocean Territory&quot;,<br>      &quot;country_code&quot;: &quot;IO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Iraq&quot;,<br>      &quot;country_code&quot;: &quot;IQ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Iceland&quot;,<br>      &quot;country_code&quot;: &quot;IS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Italy&quot;,<br>      &quot;country_code&quot;: &quot;IT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Jersey&quot;,<br>      &quot;country_code&quot;: &quot;JE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Jamaica&quot;,<br>      &quot;country_code&quot;: &quot;JM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Jordan&quot;,<br>      &quot;country_code&quot;: &quot;JO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Japan&quot;,<br>      &quot;country_code&quot;: &quot;JP&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Kenya&quot;,<br>      &quot;country_code&quot;: &quot;KE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Kyrgyzstan&quot;,<br>      &quot;country_code&quot;: &quot;KG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Cambodia&quot;,<br>      &quot;country_code&quot;: &quot;KH&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Kiribati&quot;,<br>      &quot;country_code&quot;: &quot;KI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Comoros&quot;,<br>      &quot;country_code&quot;: &quot;KM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Saint Kitts and Nevis&quot;,<br>      &quot;country_code&quot;: &quot;KN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;South Korea&quot;,<br>      &quot;country_code&quot;: &quot;KR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Kuwait&quot;,<br>      &quot;country_code&quot;: &quot;KW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Cayman Islands&quot;,<br>      &quot;country_code&quot;: &quot;KY&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Kazakhstan&quot;,<br>      &quot;country_code&quot;: &quot;KZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Laos&quot;,<br>      &quot;country_code&quot;: &quot;LA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Lebanon&quot;,<br>      &quot;country_code&quot;: &quot;LB&quot;<br>    },<br>     {<br>      &quot;name&quot;: &quot;St. Lucia&quot;,<br>      &quot;country_code&quot;: &quot;LC&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Liechtenstein&quot;,<br>      &quot;country_code&quot;: &quot;LI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Sri Lanka&quot;,<br>      &quot;country_code&quot;: &quot;LK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Liberia&quot;,<br>      &quot;country_code&quot;: &quot;LR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Lesotho&quot;,<br>      &quot;country_code&quot;: &quot;LS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Lithuania&quot;,<br>      &quot;country_code&quot;: &quot;LT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Luxembourg&quot;,<br>      &quot;country_code&quot;: &quot;LU&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Latvia&quot;,<br>      &quot;country_code&quot;: &quot;LV&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Libya&quot;,<br>      &quot;country_code&quot;: &quot;LY&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Morocco&quot;,<br>      &quot;country_code&quot;: &quot;MA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Monaco&quot;,<br>      &quot;country_code&quot;: &quot;MC&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Moldova&quot;,<br>      &quot;country_code&quot;: &quot;MD&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Montenegro&quot;,<br>      &quot;country_code&quot;: &quot;ME&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Saint Martin&quot;,<br>      &quot;country_code&quot;: &quot;MF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Madagascar&quot;,<br>      &quot;country_code&quot;: &quot;MG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Marshall Islands&quot;,<br>      &quot;country_code&quot;: &quot;MH&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Macedonia&quot;,<br>      &quot;country_code&quot;: &quot;MK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Mali&quot;,<br>      &quot;country_code&quot;: &quot;ML&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Myanmar&quot;,<br>      &quot;country_code&quot;: &quot;MM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Mongolia&quot;,<br>      &quot;country_code&quot;: &quot;MN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Macau&quot;,<br>      &quot;country_code&quot;: &quot;MO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Northern Mariana Islands&quot;,<br>      &quot;country_code&quot;: &quot;MP&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Martinique&quot;,<br>      &quot;country_code&quot;: &quot;MQ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Mauritania&quot;,<br>      &quot;country_code&quot;: &quot;MR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Montserrat&quot;,<br>      &quot;country_code&quot;: &quot;MS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Malta&quot;,<br>      &quot;country_code&quot;: &quot;MT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Mauritius&quot;,<br>      &quot;country_code&quot;: &quot;MU&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Maldives&quot;,<br>      &quot;country_code&quot;: &quot;MV&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Malawi&quot;,<br>      &quot;country_code&quot;: &quot;MW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Mexico&quot;,<br>      &quot;country_code&quot;: &quot;MX&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Malaysia&quot;,<br>      &quot;country_code&quot;: &quot;MY&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Mozambique&quot;,<br>      &quot;country_code&quot;: &quot;MZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Namibia&quot;,<br>      &quot;country_code&quot;: &quot;NA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;New Caledonia&quot;,<br>      &quot;country_code&quot;: &quot;NC&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Niger&quot;,<br>      &quot;country_code&quot;: &quot;NE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Norfolk Island&quot;,<br>      &quot;country_code&quot;: &quot;NF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Nigeria&quot;,<br>      &quot;country_code&quot;: &quot;NG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Nicaragua&quot;,<br>      &quot;country_code&quot;: &quot;NI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Netherlands&quot;,<br>      &quot;country_code&quot;: &quot;NL&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Norway&quot;,<br>      &quot;country_code&quot;: &quot;NO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Nepal&quot;,<br>      &quot;country_code&quot;: &quot;NP&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Nauru&quot;,<br>      &quot;country_code&quot;: &quot;NR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Niue&quot;,<br>      &quot;country_code&quot;: &quot;NU&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;New Zealand&quot;,<br>      &quot;country_code&quot;: &quot;NZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Oman&quot;,<br>      &quot;country_code&quot;: &quot;OM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Panama&quot;,<br>      &quot;country_code&quot;: &quot;PA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Peru&quot;,<br>      &quot;country_code&quot;: &quot;PE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;French Polynesia&quot;,<br>      &quot;country_code&quot;: &quot;PF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Papua New Guinea&quot;,<br>      &quot;country_code&quot;: &quot;PG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Philippines&quot;,<br>      &quot;country_code&quot;: &quot;PH&quot;<br>    },<br>     {<br>      &quot;name&quot;: &quot;Pakistan&quot;,<br>      &quot;country_code&quot;: &quot;PK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Poland&quot;,<br>      &quot;country_code&quot;: &quot;PL&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Saint Pierre and Miquelon&quot;,<br>      &quot;country_code&quot;: &quot;PM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Pitcairn&quot;,<br>      &quot;country_code&quot;: &quot;PN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Puerto Rico&quot;,<br>      &quot;country_code&quot;: &quot;PR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Palestine&quot;,<br>      &quot;country_code&quot;: &quot;PS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Portugal&quot;,<br>      &quot;country_code&quot;: &quot;PT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Palau&quot;,<br>      &quot;country_code&quot;: &quot;PW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Paraguay&quot;,<br>      &quot;country_code&quot;: &quot;PY&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Qatar&quot;,<br>      &quot;country_code&quot;: &quot;QA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Réunion&quot;,<br>      &quot;country_code&quot;: &quot;RE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Romania&quot;,<br>      &quot;country_code&quot;: &quot;RO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Serbia&quot;,<br>      &quot;country_code&quot;: &quot;RS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Russia&quot;,<br>      &quot;country_code&quot;: &quot;RU&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Rwanda&quot;,<br>      &quot;country_code&quot;: &quot;RW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Saudi Arabia&quot;,<br>      &quot;country_code&quot;: &quot;SA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Solomon Islands&quot;,<br>      &quot;country_code&quot;: &quot;SB&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Seychelles&quot;,<br>      &quot;country_code&quot;: &quot;SC&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Sweden&quot;,<br>      &quot;country_code&quot;: &quot;SE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Singapore&quot;,<br>      &quot;country_code&quot;: &quot;SG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Saint Helena&quot;,<br>      &quot;country_code&quot;: &quot;SH&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Slovenia&quot;,<br>      &quot;country_code&quot;: &quot;SI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Svalbard and Jan Mayen&quot;,<br>      &quot;country_code&quot;: &quot;SJ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Slovakia&quot;,<br>      &quot;country_code&quot;: &quot;SK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Sierra Leone&quot;,<br>      &quot;country_code&quot;: &quot;SL&quot;<br>    },<br>       {<br>      &quot;name&quot;: &quot;San Marino&quot;,<br>      &quot;country_code&quot;: &quot;SM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Senegal&quot;,<br>      &quot;country_code&quot;: &quot;SN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Somalia&quot;,<br>      &quot;country_code&quot;: &quot;SO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Suriname&quot;,<br>      &quot;country_code&quot;: &quot;SR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;South Sudan&quot;,<br>      &quot;country_code&quot;: &quot;SS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Sao Tome and Principe&quot;,<br>      &quot;country_code&quot;: &quot;ST&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;El Salvador&quot;,<br>      &quot;country_code&quot;: &quot;SV&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Sint Maarten&quot;,<br>      &quot;country_code&quot;: &quot;SX&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Swaziland&quot;,<br>      &quot;country_code&quot;: &quot;SZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Turks and Caicos Islands&quot;,<br>      &quot;country_code&quot;: &quot;TC&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Chad&quot;,<br>      &quot;country_code&quot;: &quot;TD&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;French Southern Territories&quot;,<br>      &quot;country_code&quot;: &quot;TF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Togo&quot;,<br>      &quot;country_code&quot;: &quot;TG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Thailand&quot;,<br>      &quot;country_code&quot;: &quot;TH&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Tajikistan&quot;,<br>      &quot;country_code&quot;: &quot;TJ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Tokelau&quot;,<br>      &quot;country_code&quot;: &quot;TK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Timor-Leste&quot;,<br>      &quot;country_code&quot;: &quot;TL&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Turkmenistan&quot;,<br>      &quot;country_code&quot;: &quot;TM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Tunisia&quot;,<br>      &quot;country_code&quot;: &quot;TN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Tonga&quot;,<br>      &quot;country_code&quot;: &quot;TO&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Turkey&quot;,<br>      &quot;country_code&quot;: &quot;TR&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Trinidad and Tobago&quot;,<br>      &quot;country_code&quot;: &quot;TT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Tuvalu&quot;,<br>      &quot;country_code&quot;: &quot;TV&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Taiwan&quot;,<br>      &quot;country_code&quot;: &quot;TW&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Tanzania&quot;,<br>      &quot;country_code&quot;: &quot;TZ&quot;<br>    },<br>       {<br>      &quot;name&quot;: &quot;Ukraine&quot;,<br>      &quot;country_code&quot;: &quot;UA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Uganda&quot;,<br>      &quot;country_code&quot;: &quot;UG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;United States Minor Outlying Islands&quot;,<br>      &quot;country_code&quot;: &quot;UM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;United States&quot;,<br>      &quot;country_code&quot;: &quot;US&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Uruguay&quot;,<br>      &quot;country_code&quot;: &quot;UY&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Uzbekistan&quot;,<br>      &quot;country_code&quot;: &quot;UZ&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Vatican City&quot;,<br>      &quot;country_code&quot;: &quot;VA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Saint Vincent and the Grenadines&quot;,<br>      &quot;country_code&quot;: &quot;VC&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Venezuela&quot;,<br>      &quot;country_code&quot;: &quot;VE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;British Virgin Islands&quot;,<br>      &quot;country_code&quot;: &quot;VG&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;US Virgin Islands&quot;,<br>      &quot;country_code&quot;: &quot;VI&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Vietnam&quot;,<br>      &quot;country_code&quot;: &quot;VN&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Vanuatu&quot;,<br>      &quot;country_code&quot;: &quot;VU&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Wallis and Futuna&quot;,<br>      &quot;country_code&quot;: &quot;WF&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Samoa&quot;,<br>      &quot;country_code&quot;: &quot;WS&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Kosovo&quot;,<br>      &quot;country_code&quot;: &quot;XK&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Yemen&quot;,<br>      &quot;country_code&quot;: &quot;YE&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Mayotte&quot;,<br>      &quot;country_code&quot;: &quot;YT&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;South Africa&quot;,<br>      &quot;country_code&quot;: &quot;ZA&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Zambia&quot;,<br>      &quot;country_code&quot;: &quot;ZM&quot;<br>    },<br>    {<br>      &quot;name&quot;: &quot;Zimbabwe&quot;,<br>      &quot;country_code&quot;: &quot;ZW&quot;<br>    }<br>  ]<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14bb131bd01d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PHP Code Quality right from the start]]></title>
            <link>https://medium.com/@felixlehmann_74058/php-code-quality-from-the-beginning-67cb878e5ffa?source=rss-63aad9f06ae8------2</link>
            <guid isPermaLink="false">https://medium.com/p/67cb878e5ffa</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[unittest]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Felix Lehmann]]></dc:creator>
            <pubDate>Sat, 02 Dec 2017 18:29:09 GMT</pubDate>
            <atom:updated>2017-12-04T13:57:42.501Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Scenario</strong></h3><p>“<em>New project [name], new idea [detail] — we need a prototype, a MVP!</em>” is how great things start.</p><p>“<em>It just has to work now as fast as possible. I’ll clean up the code later, for sure. I will write tests to cover the majority of the code later, for sure</em>” is how it continues.</p><p>This is the spirit of putting new ideas into practice. But everybody knows that it’s unlikely that you will find time to fix technical debt, once a project got traction. It becomes more important to constantly release new features, bloating up the codebase, making it harder to get things right later. It slows you down, creates potentially more bugs and makes it more difficult for new people to follow your code.</p><p><strong>Sounds familiar to you?</strong></p><p>So this article reflects what I learned what works well when it comes to projects coded with PHP (whether you like PHP or not, PHP is still very popular). The theory applies to all languages, but tooling will be described for PHP.</p><p>I’m sure that you read articles telling you how to code clean with small methods, following coding standards, formatting code, following S.O.L.I.D principles and so on.</p><h3>Tools</h3><p>So you know all the theory about great code, but why does it still happen that you fail to follow things even if you should know it better?</p><p>Because you’re not forced to follow the rules!</p><p>What if you could constantly check projectwide that you meeting your own standards?</p><p>When I started to look for tools, I found the number of tools overwhelming, was afraid and stepped back. We don’t have to.</p><p>Here are some tools that I use for every new project by default:</p><ol><li><a href="https://getcomposer.org/">Composer</a>: A dependency manager, making it very easy to include external libraries into your project and the basis for the following tools.</li><li><a href="https://github.com/sebastianbergmann/phploc">PHPLOC</a>: Gives you a brief overview of the code size, complexity, dependencies and structure.</li><li><a href="https://github.com/squizlabs/PHP_CodeSniffer">Codesniffer</a>: Lets you define rules (“sniffs”) as your coding standard or use predefined <a href="http://www.php-fig.org/psr/">PHP Standards Recommendations</a> (not all of them can be covered by codesniffer). Secondly <em>Codesniffer</em> brings you a tool called <em>PHP Code Beautifier and Fixer</em>, which can automatically fix most of the detected sniff violations.</li><li><a href="https://github.com/phpstan/phpstan">PHPStan</a>: Runs a static code analysis, showing you wrong types, differences between method declarations and doc blocks and much more. This helps to find a lot of small mistakes even before you actually execute the code for the first time or create tests.</li><li><a href="https://github.com/sebastianbergmann/phpcpd">Copy-Paste-Detector (PHPCPD)</a>: Finds duplicated code as it’s name implies. Shows you the files and lines where the duplications are. Indicates where you probably can replace duplicated code by a new method.</li><li><a href="https://phpmd.org/">Mess-Detector (PHPMD)</a>: Has rules for clean code, code size, naming, design and unused code.</li><li><a href="https://phpunit.de/">PHPUnit</a>: Allows you to write tests for every line of PHP code in your project and can create a code coverage report. This report shows you what is covered by your tests. Helps you to find blind spots in the code, that can not be reached or where you need another</li></ol><p>All of these tools alone are very helpful, but together they really will raise the level of quality in your projects.</p><h3>Installation</h3><p>Time to get your hands on things. I will show how to do it in an Ubuntu environment.</p><p>To get started with the tools I would recommend to open the commandline and create a new folder</p><p>cd ~ &amp;&amp; mkdir medium &amp;&amp; cd medium</p><p><strong>Get composer</strong></p><p>The easiest way to install composer is (for other ways, check <a href="https://getcomposer.org/">https://getcomposer.org/</a>)</p><p>sudo apt install composer</p><p><strong>Initialize composer in your project</strong></p><p>Composer needs a <em>composer.json</em> file that includes your desired dependencies. So we initialize the file.</p><pre>composer init</pre><p>Which will result in an interactive menu, that you could fill out minimalistic like this:</p><pre>Package name (&lt;vendor&gt;/&lt;name&gt;) [root/medium]: felix/medium<br>Description []: Composer Test Setup<br>Author [Your name, n to skip]: n<br>Minimum Stability []: <br>Package Type []: <br>License []:</pre><pre>Would you like to define your dependencies (require) interactively [yes]? no<br>Would you like to define your dev dependencies (require-dev) interactively [yes]? no<br>Do you confirm generation [yes]?</pre><p>This creates your composer.json file locally that looks pretty empty:</p><pre>cat composer.json<br>{<br> “name”: “felix/medium”,<br> “description”: “Composer Test Setup”,<br> “require”: {}<br>}</pre><p>No it’s time to let composer do the magic for us and setup all of our tools. Composer supports two different ways of using packages. One way is to use it as a development dependency, which you basically need on your development machine and on testservers. To install a development requirement, type</p><pre>composer require --dev &lt;vendor&gt;/&lt;name&gt;</pre><p>When you leave out the <em>dev</em> parameter, you add the dependency as always required. Why is this even possible? Because you usually don’t want all of your code quality tools to be part on the production system. To leave out development dependencies on production server, execute</p><pre>composer install --no-dev</pre><p><strong>Adding our tools to composer</strong></p><p>We can now install the tools within our project with just one command</p><pre>composer require --dev phploc/phploc squizlabs/php_codesniffer:3.* phpstan/phpstan sebastian/phpcpd phpmd/phpmd phpunit/phpunit:^6.5</pre><p>Which results in an extended <em>composer.json</em> file</p><pre>{<br> “name”: “felix/medium”,<br> &quot;description”: “Composer Test Setup”,<br> “require”: {},<br> “require-dev”: {<br>   “phploc/phploc”: “^4.0”,<br>   “squizlabs/php_codesniffer”: “3.*”,<br>   “phpstan/phpstan”: “^0.9.0”,<br>   “sebastian/phpcpd”: “^3.0”,<br>   “phpmd/phpmd”: “^2.6”,<br>   “phpunit/phpunit”: “^6.5”<br> }<br>}</pre><p>And we now do have a new <em>vendor</em> folder where all the dependencies are located in.</p><h3>Usage</h3><p>How can we now make use of the tools?</p><p>I would say lets inspect some existing code with our tools.</p><p>We install the <em>CakePHP</em> framework and their example app just to have something that we can test</p><pre>cd ~/medium &amp;&amp; composer require cakephp/cakephp cakephp/app</pre><p><strong>Start the engines</strong></p><p>Go back to the project root folder</p><pre>cd ~/medium</pre><p>And start calling <em>PHPLOC</em> on our <em>app</em> folder</p><p><strong>PHPLOC</strong></p><pre>vendor/bin/phploc vendor/cakephp/app/</pre><p>You should see a nice overview, telling us that the code is in a well commented, not to complex shape (you will learn how to interpret the numbers after time).</p><p><em>To make things clear</em>: Instead of <em>vendor/cakephp/app/</em> you should use a folder like <em>src/</em> where your actual code is located. Don’t put your code into the vendor folder.</p><p>Great. Let’s go on with <em>Codesniffer</em></p><p><strong>Codesniffer</strong></p><pre>vendor/bin/phpcs vendor/cakephp/app/</pre><p>This should give you quite some errors and warnings together with the filename and line where they occurred. But what rules are used here? We didn’t configure them. By default, <em>Codesniffer</em> will use the <a href="https://pear.php.net/manual/en/standards.php">PEAR coding standard</a>. You can create your own coding standard, but I would not recommend to do it. When I work with frameworks, <em>CakePHP</em> for example, I use their standard (install <em>cakephp-codesniffer</em> via composer first):</p><pre>cd ~/medium &amp;&amp; vendor/bin/phpcs --config-set installed_paths vendor/cakephp/cakephp-codesniffer</pre><p>Now I would fix all of these errors and warnings before going on.</p><p>But let’s jump to the Copy-Paste-Detector</p><p><strong>Copy-Paste-Detector</strong></p><pre>vendor/bin/phpcpd vendor/cakephp/app/</pre><p>Shows us no clones. Good job!</p><p><strong>PHPStan</strong></p><p>In order to use PHPStan we need an additional file with for configuration. Let’s call it phpstan.neon and leave it empty.</p><pre>cd ~/medium &amp;&amp; touch phpstan.neon</pre><p>And run PHPStan, tell it to analyse one the highest level.</p><pre>vendor/bin/phpstan analyse -l 7 phpstan.neon vendor/cakephp/app/src/</pre><p>This should give some typehint and class not found errors.</p><p><strong>Mess-Detector</strong></p><p>PHPMD needs another config file that we will create.</p><pre>cd ~/medium &amp;&amp; touch phpmd.xml</pre><p>Insert the following content</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;ruleset name=&quot;pcsg-generated-ruleset&quot; <br>    xmlns=&quot;http://pmd.sf.net/ruleset/1.0.0&quot; <br>    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; <br>    xsi:schemaLocation=&quot;http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd&quot;<br>    xsi:noNamespaceSchemaLocation=&quot;http://pmd.sf.net/ruleset_xml_schema.xsd&quot;&gt;<br>&lt;description&gt;Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/<br>&lt;/description&gt;<br>  &lt;rule ref=&quot;rulesets/cleancode.xml&quot; /&gt;<br>  &lt;rule ref=&quot;rulesets/codesize.xml&quot;/&gt;<br>  &lt;rule ref=&quot;rulesets/controversial.xml&quot;/&gt;<br>  &lt;rule ref=&quot;rulesets/design.xml&quot;/&gt;<br>  &lt;rule ref=&quot;rulesets/naming.xml&quot;/&gt;<br>  &lt;rule ref=&quot;rulesets/unusedcode.xml&quot;/&gt;<br>&lt;/ruleset&gt;</pre><p>You can generate a more fine grain version using the <a href="http://edorian.github.io/php-coding-standard-generator/#phpmd">online generator</a>.</p><p>Now let’s call PHPMD and see the output</p><pre>vendor/bin/phpmd vendor/cakephp/app/src/ text phpmd.xml</pre><p>You should get again some unused parameters, static access errors and more.</p><p><strong>PHPUnit</strong></p><p>Now let’s run some tests on CakePHP</p><pre>vendor/bin/phpunit vendor/cakephp/app/tests/</pre><p>You should see the number of tests, assertions and errors.</p><h3>Conclusion</h3><p>Congratulations, you learned how to install and make use of a set of code quality tools.</p><p>Now you should start to apply these tools on your own code. Either fix the errors, choose the best rulesets for you or customize the rulesets to your requirements. And finally <a href="https://www.youtube.com/watch?v=ezHn1rPRlg0&amp;t=1757s">start adding tests for your code</a>. Feel better about your code.</p><p>Personally I execute the tools as often as possible. Therefore I use a shellscript that simply chains the commands and returns their output if there was an error. And I use this as a git pre-commit hook, too. This way I know that the code looks good and tests are fine. A (short) example for this is also shipped with the CakePHP source:</p><pre>cat ~/medium/vendor/cakephp/cakephp/contrib/pre-commit</pre><p>Depending on the size of your project you may not always run all tools.</p><p>If you have questions or remarks, please let me know in the comments.</p><p>You can find me on <a href="https://www.linkedin.com/in/felixlehmann1986/">LinkedIn</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VbgScPbmgShG-7nu-i2y2w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67cb878e5ffa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>