<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: fadilxcoder</title>
    <description>The latest articles on DEV Community by fadilxcoder (@fadilxcoder).</description>
    <link>https://dev.to/fadilxcoder</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F125753%2F55736706-8313-456a-8732-bc471d85ca91.jpg</url>
      <title>DEV Community: fadilxcoder</title>
      <link>https://dev.to/fadilxcoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fadilxcoder"/>
    <language>en</language>
    <item>
      <title>Codeigniter 4 with Docker on AWS Cloud9</title>
      <dc:creator>fadilxcoder</dc:creator>
      <pubDate>Sun, 26 Apr 2020 11:57:30 +0000</pubDate>
      <link>https://dev.to/fadilxcoder/codeigniter-4-with-docker-on-aws-cloud9-4df8</link>
      <guid>https://dev.to/fadilxcoder/codeigniter-4-with-docker-on-aws-cloud9-4df8</guid>
      <description>&lt;p&gt;Hey devs 💻, I've been spending my days during lockdown trying get familiar with Docker &amp;amp; Amazon Web Services (AWS) Cloud9. &lt;/p&gt;

&lt;p&gt;As a PHP developer, I once was using Codeigniter 3 for developing applications. Then it came to my attention that Codeigniter 4 (CI4) was released. &lt;/p&gt;

&lt;p&gt;So I decided to combine these 3 and by using &lt;strong&gt;AWS - Ubuntu Server 18.04 LTS&lt;/strong&gt; Platform, I will use &lt;strong&gt;Docker&lt;/strong&gt; and have &lt;strong&gt;CI4&lt;/strong&gt; working on it.&lt;/p&gt;

&lt;p&gt;My AWS environment settings are as follows :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Environment type : &lt;strong&gt;EC2&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Platform : &lt;strong&gt;Ubuntu Server 18.04 LTS&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let the trip begin 😎
&lt;/h2&gt;

&lt;p&gt;In your bash terminal on AWS, just to check the php version, we won't be using this one though.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ubuntu:~/environment $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;php &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Normally you should see &lt;em&gt;php version 7.2&lt;/em&gt;,&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fn560rn12whom8xl4c3lz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fn560rn12whom8xl4c3lz.png" alt="PHP version"&gt;&lt;/a&gt;PHP version&lt;/p&gt;

&lt;p&gt;I actually spent couple of days trying to built a nice Docker Environment comprising of&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;nginx&lt;/li&gt;
&lt;li&gt;php-pfm&lt;/li&gt;
&lt;li&gt;database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is available on Github&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/fadilxcoder" rel="noopener noreferrer"&gt;
        fadilxcoder
      &lt;/a&gt; / &lt;a href="https://github.com/fadilxcoder/docker-env" rel="noopener noreferrer"&gt;
        docker-env
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Docker Environment Configuration
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;NGINX / APACHE / PHP-FPM / ADMINER&lt;/h1&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;PHP Extension installer : &lt;a href="https://github.com/mlocati/docker-php-extension-installer" rel="noopener noreferrer"&gt;https://github.com/mlocati/docker-php-extension-installer&lt;/a&gt; (Git repo)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NOTE&lt;/strong&gt; : Replace with : &lt;code&gt;https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt; :&lt;/p&gt;

&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;FROM php:7.2-cli

ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN chmod +x /usr/local/bin/install-php-extensions &amp;amp;&amp;amp; \
    install-php-extensions gd xdebug
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;To verify if extension is present, use command : &lt;code&gt;php -m|grep mysql&lt;/code&gt; for example&lt;/li&gt;
&lt;li&gt;Connect to App Terminal : &lt;code&gt;docker exec -it fx_php_fpm ash&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Verify if container is UP : &lt;code&gt;docker ps&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;NOTES&lt;/h1&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Docker Apache : &lt;a href="https://github.com/fadilxcoder/docker-env/tree/master-apache" rel="noopener noreferrer"&gt;https://github.com/fadilxcoder/docker-env/tree/master-apache&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docker symfony : &lt;a href="https://github.com/fadilxcoder/docker-env/tree/symfony" rel="noopener noreferrer"&gt;https://github.com/fadilxcoder/docker-env/tree/symfony&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;BUILD / UP : &lt;code&gt;docker-compose up --build -d&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;UP : &lt;code&gt;docker-compose up&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;DOWN : &lt;code&gt;MySQL version - docker-compose down --remove-orphans&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;DETAILS&lt;/h1&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;PHP : &lt;code&gt;8.1.5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;NGINX : &lt;code&gt;nginx/1.21.6&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;MySQL version : &lt;code&gt;10.7.3-MariaDB-1:10.7.3+maria~focal&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;URL&lt;/h1&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;URL : &lt;a href="http://localhost:8881/" rel="nofollow noopener noreferrer"&gt;http://localhost:8881/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PHPINFO : &lt;a href="http://localhost:8881/phpinfo.php" rel="nofollow noopener noreferrer"&gt;http://localhost:8881/phpinfo.php&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ADMINER : &lt;a href="http://localhost:8881/adminer.php" rel="nofollow noopener noreferrer"&gt;http://localhost:8881/adminer.php&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Server&lt;/strong&gt; : &lt;code&gt;database&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Username&lt;/strong&gt; : &lt;code&gt;myuser&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Password&lt;/strong&gt; : &lt;code&gt;secret&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Database&lt;/strong&gt; : &lt;code&gt;mydb&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/fadilxcoder/docker-env" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Clone the repository and move the files to the root of your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ubuntu:~/environment $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;git clone https://github.com/fadilxcoder/docker-env.git
&lt;span class="gp"&gt;ubuntu:~/environment $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;docker-env/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;,.&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; ./
&lt;span class="gp"&gt;ubuntu:~/environment $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;rmdir &lt;/span&gt;docker-env/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flsvqegda9fthsxnop3zt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flsvqegda9fthsxnop3zt.png" alt="AWS"&gt;&lt;/a&gt;AWS&lt;/p&gt;

&lt;p&gt;Okay, from here i'll explain to you the file structure.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In &lt;code&gt;src&lt;/code&gt; folder, we will add only the application codes. It can be html, js, css, php files or assets (images / favicon). Overall , our codes goes in this folder.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In &lt;code&gt;docker&lt;/code&gt; folder, it consist of a docker-compose file where we have the configuration parameters for docker and other Dockerfile each for an image. Depending on your application, you might need to updated these files before building it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we will get CI4 working!&lt;/p&gt;

&lt;h2&gt;
  
  
  Let the trip continue 👽
&lt;/h2&gt;

&lt;p&gt;You will have to edit the Dockerfile in php-fpm as CI4 uses the intl php extension.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;RUN chmod uga+x /usr/local/bin/install-php-extensions &amp;amp;&amp;amp; sync &amp;amp;&amp;amp; \
    install-php-extensions gd xdebug mysqli intl
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ans also in docker-compose.yml, change port as AWS by default uses port &lt;code&gt;8080&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;    ports:
      - "8080:80"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AWS Environment does not have &lt;code&gt;docker-compose&lt;/code&gt; command by default, you will need to install it by running &lt;code&gt;sudo apt install docker-compose&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once installed, go to docker repository and run :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ubuntu:~/environment/docker $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;docker-compose up &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It might take some time as it will have to download the image if it is not present.&lt;/p&gt;

&lt;p&gt;Open up another terminal in your AWS and check the container status whether it is up and running,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ubuntu:~/environment/docker $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;docker ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm6fk6bt8dysxbwjruwrz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm6fk6bt8dysxbwjruwrz.png" alt="AWS Docker Container"&gt;&lt;/a&gt;AWS Docker Container&lt;/p&gt;

&lt;p&gt;Now you will need to connect to your container terminal,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ubuntu:~/environment $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; fx_php_fpm ash
&lt;span class="gp"&gt;/var/www/html #&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;composer create-project codeigniter4/appstarter ci4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The installation will start...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F91743ifdal6lp3ly565t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F91743ifdal6lp3ly565t.png" alt="CI4 in Docker Container"&gt;&lt;/a&gt;CI4 in Docker Container&lt;/p&gt;

&lt;h2&gt;
  
  
  95% complete 😁
&lt;/h2&gt;

&lt;p&gt;In the &lt;code&gt;src&lt;/code&gt; folder, uncomment the &lt;code&gt;phpinfo();&lt;/code&gt; save the file and the preview your application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkeujizga4orq4tn3xwp1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkeujizga4orq4tn3xwp1.png" alt="php version 7.4.5"&gt;&lt;/a&gt;php version 7.4.5&lt;/p&gt;

&lt;p&gt;To preview your CI4 application,&lt;/p&gt;

&lt;p&gt;URL : &lt;code&gt;http://xxxxxxxxxxxxxxxxxxxxxxxxx.vfs.cloud9.us-east-2.amazonaws.com/ci4/public/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkny0p350tp222kevusdr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkny0p350tp222kevusdr.png" alt="Codeigniter 4"&gt;&lt;/a&gt;Codeigniter 4&lt;/p&gt;

&lt;p&gt;One problem that you might come across is that you may not be able to edit the code of the codeigniter app. &lt;/p&gt;

&lt;p&gt;But no worry 😃&lt;/p&gt;

&lt;p&gt;Use the 2 commands below to change files ownership &amp;amp; group.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ubuntu:~/environment/src $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; ubuntu ci4/
&lt;span class="gp"&gt;ubuntu:~/environment/src $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;sudo chgrp&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; ubuntu ci4/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fosvo5zbqycsu9qpykku1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fosvo5zbqycsu9qpykku1.png" alt="File Permission"&gt;&lt;/a&gt;File permission&lt;/p&gt;

&lt;h2&gt;
  
  
  Trip's over ✨✨✨ 👊 ❤️ ✌️ ✨✨✨
&lt;/h2&gt;

&lt;p&gt;Now we have a fully functional docker container with Codeigniter on AWS C9 and you can code on it anytime/ anywhere...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fthr6r8m9m496jnpax8re.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fthr6r8m9m496jnpax8re.gif" alt="We did it folks"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud9</category>
      <category>codeigniter</category>
      <category>docker</category>
    </item>
    <item>
      <title>PHP 7 on Amazon Web Services (AWS) Cloud9</title>
      <dc:creator>fadilxcoder</dc:creator>
      <pubDate>Sat, 14 Dec 2019 14:06:55 +0000</pubDate>
      <link>https://dev.to/fadilxcoder/php-7-on-amazon-web-services-aws-cloud9-3oln</link>
      <guid>https://dev.to/fadilxcoder/php-7-on-amazon-web-services-aws-cloud9-3oln</guid>
      <description>&lt;p&gt;Hello guys,&lt;/p&gt;

&lt;p&gt;On thing that I've noticed when working with AWS cloud9 is that by default, it has PHP 5 installed. My question was what if I want to use PHP 7 for development ?&lt;/p&gt;

&lt;p&gt;So in this post, I will explain to you how to setup your PHP 7 environement on AWS.&lt;/p&gt;

&lt;p&gt;I am assuming that your AWS settings are as follows :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Environment type : &lt;strong&gt;EC2&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Platform : &lt;strong&gt;Amazon Linux&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let's get started.
&lt;/h2&gt;

&lt;p&gt;In your bash terminal on AWS, check your current PHP version,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ec2-user:~/environment $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;php &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Normally you should see,&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E_Xl9Ies--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/yx3bys2cqv7zgp208bx5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E_Xl9Ies--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/yx3bys2cqv7zgp208bx5.png" alt="PHP version" width="797" height="319"&gt;&lt;/a&gt;PHP version&lt;/p&gt;

&lt;p&gt;In order to do these changes, you will need to connect as root, so just type &lt;em&gt;sudo su&lt;/em&gt; followed by &lt;em&gt;yum update&lt;/em&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;ec2-user:~/environment $&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;su
&lt;span class="gp"&gt;[root@ip-172-31-30-164 environment]#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;yum update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VM1XY9bT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/qlaf8198qzsca0wu91jp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VM1XY9bT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/qlaf8198qzsca0wu91jp.png" alt="Update packages" width="800" height="680"&gt;&lt;/a&gt;&lt;/p&gt;
Update packages



&lt;p&gt;The process might take couple of minutes. Then remove any existing PHP packages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;[root@ip-172-31-30-164 environment]#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;yum remove php&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wFYawp3o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/zqyw5f0bzqw0a513667n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wFYawp3o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/zqyw5f0bzqw0a513667n.png" alt="PHP packages removal" width="599" height="238"&gt;&lt;/a&gt;&lt;/p&gt;
PHP packages removal



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; : If you already have Apache 2.4, you don't need to remove your web server but if you have an older version, then remove it and install Apache 2.4,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;[root@ip-172-31-30-164 environment]#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;yum remove httpd&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;[root@ip-172-31-30-164 environment]#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;httpd24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;If everything is working fine till now, you did a great job.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now it's time to install PHP 7. As you know, there are multiple versions, i.e : &lt;code&gt;php7.0&lt;/code&gt;, &lt;code&gt;php7.1&lt;/code&gt;, &lt;code&gt;php7.2&lt;/code&gt;...&lt;/p&gt;

&lt;p&gt;Below are the command for different php version you want to install.&lt;/p&gt;

&lt;h3&gt;
  
  
  PHP 7.0
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;[root@ip-172-31-30-164 environment]#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;php70 php70-mysqlnd php70-imap php70-pecl-memcache php70-pecl-apcu php70-gd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  PHP 7.1
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;[root@ip-172-31-30-164 environment]#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;php71 php71-mysqlnd php71-imap php71-pecl-memcache php71-pecl-apcu php71-gd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  PHP 7.2
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;[root@ip-172-31-30-164 environment]#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;php72 php72-mysqlnd php72-imap php72-pecl-memcache php72-pecl-apcu php72-gd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's say we want to have &lt;strong&gt;PHP 7.2&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cW9zsQik--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/kv95nhreopc2kl22jfhl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cW9zsQik--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/kv95nhreopc2kl22jfhl.png" alt="PHP 7.2" width="800" height="305"&gt;&lt;/a&gt;&lt;/p&gt;
PHP 7.2



&lt;p&gt;And here you have it..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--581ZGxbT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/gnuysuy4rfup3bqoin00.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--581ZGxbT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/gnuysuy4rfup3bqoin00.png" alt="PHP version" width="534" height="138"&gt;&lt;/a&gt;&lt;/p&gt;
PHP version



&lt;p&gt;You can easily work with PHP 7 on AWS now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tc1Wdjw3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/3nn29cq79y8qjg9gghls.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tc1Wdjw3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/3nn29cq79y8qjg9gghls.gif" alt="We did it" width="540" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud9</category>
      <category>php</category>
      <category>bash</category>
    </item>
    <item>
      <title>As a Developer, I did my first Web Penetration Testing</title>
      <dc:creator>fadilxcoder</dc:creator>
      <pubDate>Tue, 15 Oct 2019 11:21:20 +0000</pubDate>
      <link>https://dev.to/fadilxcoder/as-a-developer-i-did-my-first-web-penetration-testing-563</link>
      <guid>https://dev.to/fadilxcoder/as-a-developer-i-did-my-first-web-penetration-testing-563</guid>
      <description>&lt;p&gt;Hello Dev peeps,&lt;/p&gt;

&lt;p&gt;I was on Facebook, scrolling on my News Feed and I came across an Ads regarding an online music web application that was just released. So I decided to visit the website and explored it. There were some free tracks &amp;amp; some premium tracks.&lt;/p&gt;

&lt;p&gt;While exploring, something came across my mind, "&lt;strong&gt;Is this site really secured ?&lt;/strong&gt;". This is where my journey started..&lt;/p&gt;

&lt;h2&gt;
  
  
  A journey of a thousand miles begins with a single step
&lt;/h2&gt;

&lt;p&gt;I did not know exactly how to proceed but the first step was to examine the website through &lt;strong&gt;&lt;em&gt;Google Chrome - DevTools&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So I click on a random premium song to see what is going on in the &lt;strong&gt;Network&lt;/strong&gt; tab in the DevTools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6vgiEXw7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/bmlo4wknoo6ocehzim6l.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6vgiEXw7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/bmlo4wknoo6ocehzim6l.JPG" alt="Music App URL" width="779" height="36"&gt;&lt;/a&gt;&lt;/p&gt;
Music App URL



&lt;p&gt;When clicking on the play icon, I was checking the &lt;strong&gt;Network&lt;/strong&gt; and I found 2 interesting URL, &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ww6QJSlK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/pj8f7ylbuk3y37qdg4nr.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ww6QJSlK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/pj8f7ylbuk3y37qdg4nr.JPG" alt="Network tab in DevTools" width="313" height="320"&gt;&lt;/a&gt;&lt;/p&gt;
Network tab in DevTools



&lt;ul&gt;
&lt;li&gt;&lt;em&gt;get-song-info?hash_id=40f65e3dad2b5d1....&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;get-track.php?id=I6OTPf15O79FuKg&amp;amp;hash=b28ee5...&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eventually I clicked on both URL, The first one redirect me to a JSON formatted webpage where all the data of the particular song were displayed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hHq8dH8p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/nwqewchia5ty39yj9pxm.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hHq8dH8p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/nwqewchia5ty39yj9pxm.JPG" alt="JSON data" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;
JSON data



&lt;p&gt;Whereas the second URL show only &lt;strong&gt;Access denied&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4WhhHghm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/1fx5ouohpm5mh952gfv0.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4WhhHghm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/1fx5ouohpm5mh952gfv0.JPG" alt="Access denied" width="800" height="71"&gt;&lt;/a&gt;&lt;/p&gt;
Access denied



&lt;p&gt;After spending sometime analyzing the situation, I said let's figure out a way to download one premium song without buying it.&lt;/p&gt;

&lt;p&gt;My guess was that the Music App Developer use a call to action that trigger a PHP script via an API, when a user click the play icon and this script was returning a "&lt;strong&gt;&lt;em&gt;content-type: audio/mpeg&lt;/em&gt;&lt;/strong&gt;". &lt;/p&gt;

&lt;p&gt;In other words, the URL that was showing &lt;em&gt;Access denied&lt;/em&gt; web page cannot be called directly by copying &amp;amp; pasting the URL in your web browser. It should be called by an API.&lt;/p&gt;

&lt;p&gt;I used &lt;a href="https://apitester.com/"&gt;API TESTER&lt;/a&gt; to simulate the test and as expected..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---ZPTCVaA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/rasid2qajds7voryawzw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---ZPTCVaA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/rasid2qajds7voryawzw.gif" alt="It did not work !" width="498" height="498"&gt;&lt;/a&gt;&lt;/p&gt;
Bad news ! It did not work !



&lt;p&gt;I noticed that in the &lt;strong&gt;Network&lt;/strong&gt; tab in the DevTools, there were other parameters sent as &lt;strong&gt;Request Header&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5nmbVzV0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/1vru4l0gzeou1s0wr1jr.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5nmbVzV0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/1vru4l0gzeou1s0wr1jr.JPG" alt="Request Header" width="800" height="317"&gt;&lt;/a&gt;&lt;/p&gt;
Request Header



&lt;p&gt;After many trials and errors, I was able to simulate it by adding some of those &lt;strong&gt;Request Header&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zx3VGGL7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/y1owr9qe7sq2lpkfh2jz.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zx3VGGL7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/y1owr9qe7sq2lpkfh2jz.JPG" alt="API TESTER - simulation" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;
API TESTER - simulation



&lt;p&gt;And 💥, I got the Response.. BUT in an unexpected format 😖&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w4k955MP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/qomwetddbw055gs6g2zw.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w4k955MP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/qomwetddbw055gs6g2zw.JPG" alt="Response Body" width="800" height="161"&gt;&lt;/a&gt;&lt;/p&gt;
Response Body



&lt;p&gt;But it was not a big deal, I clicked on the &lt;em&gt;eye&lt;/em&gt; icon on top-right and the premium song open in another tab in my browser and I was able to listen to it freely without having to buy it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I1rxR-bF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/s3vn1r0imm6zzkgks02q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I1rxR-bF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/s3vn1r0imm6zzkgks02q.gif" alt="Congratulation" width="500" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;For your info, I got into contact with the Owner of the Online Music Application to report the issue. I don't know if they fixed it yet&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>api</category>
      <category>pentester</category>
      <category>cyberattack</category>
    </item>
    <item>
      <title>JQuery Mobile App development by using XML, JSON, PhoneGap and PHP</title>
      <dc:creator>fadilxcoder</dc:creator>
      <pubDate>Sun, 14 Apr 2019 16:40:17 +0000</pubDate>
      <link>https://dev.to/fadilxcoder/jquery-mobile-app-development-by-using-xml-json-phonegap-and-php-36dj</link>
      <guid>https://dev.to/fadilxcoder/jquery-mobile-app-development-by-using-xml-json-phonegap-and-php-36dj</guid>
      <description>&lt;p&gt;Hello folks,&lt;/p&gt;

&lt;p&gt;During these couple of days, I was developing a basic mobile application that's only functionality was to display some data that it retrieves somewhere on the web. I named it "&lt;strong&gt;RSS FEED&lt;/strong&gt;"&lt;/p&gt;

&lt;h2&gt;
  
  
  Here is how it looks like !
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O73-qfIi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/eiuoe8xo62dv5srxbdal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O73-qfIi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/eiuoe8xo62dv5srxbdal.png" alt="App Icon" width="480" height="854"&gt;&lt;/a&gt;App Icon&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GwK6DM1J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/sntbsiqdn1hs0v6cr0c0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GwK6DM1J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/sntbsiqdn1hs0v6cr0c0.png" alt="App landing page #1" width="480" height="854"&gt;&lt;/a&gt;App landing page&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jm2s3yUa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/eg5ehprd2kx3lpnw2zwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jm2s3yUa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/eg5ehprd2kx3lpnw2zwi.png" alt="App landing page #2" width="480" height="854"&gt;&lt;/a&gt;App landing page (scrolling a bit down)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G5HTaaAi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/fndlrj7f5b0weq87itkh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G5HTaaAi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/fndlrj7f5b0weq87itkh.png" alt="Clicking on an article and pop up" width="480" height="854"&gt;&lt;/a&gt;Clicking on an article &amp;amp; it pop up&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's get to the core of what's exactly happening !
&lt;/h2&gt;

&lt;p&gt;So, there is this website &lt;a href="https://www.networkworld.com/"&gt;NETWORK WORLD FROM IDG&lt;/a&gt; that has an &lt;a href="https://www.networkworld.com/index.rss"&gt;RSS&lt;/a&gt;. As usual, they are in XML format.&lt;/p&gt;

&lt;p&gt;So what am doing is, I am using these XML, converting them into JSON by a PHP script hosted on my server and sending those JSON to the JQuery Mobile App and displaying them there and when a user click on a particular article's title, the whole article pop up so they can read it.&lt;/p&gt;

&lt;p&gt;Any updates that is made is the XML file will update the mobile app in real time.&lt;/p&gt;

&lt;h2&gt;
  
  
  How did I work it out ?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Advice
&lt;/h3&gt;

&lt;p&gt;To work on this, I used PhoneGap, which you can use to easily create mobile app in HTML, CSS &amp;amp; JavaScript. I also used WampServer as I was working on localhost during development. And finally you will need a Hosting &amp;amp; Domain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Pssst, you can use free &lt;a href="https://www.000webhost.com/"&gt;000Webhost&lt;/a&gt; web hosting&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start PhoneGap and build a blank project&lt;/li&gt;
&lt;li&gt;Checking the &lt;a href="http://demos.jquerymobile.com/1.4.5/"&gt;JQuery Mobile Demos&lt;/a&gt; in order to know which element to use to develop the mobile app front-end.&lt;/li&gt;
&lt;li&gt;Build an Static Mobile App according to the design's wireframing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After this part was completed, It was time to work with the XML. My only reason why I choose to work with JSON and not XML was simply because I feel more at ease with JSON.&lt;/p&gt;

&lt;p&gt;I used a PHP Script that convert XML to JSON. Then I uploaded it on my server and it's done. It is returning JSON formatted data.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/saqueib"&gt;
        saqueib
      &lt;/a&gt; / &lt;a href="https://github.com/saqueib/qrss"&gt;
        qrss
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      PHP API class for parsing RSS feed and returning JSON http://www.qcode.in/build-complete-rss-feed-reader-app-php-rss-json-api/
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
qrss&lt;/h1&gt;
&lt;p&gt;An API Class to parse the RSS feed into json with cache option.&lt;/p&gt;
&lt;h2&gt;
Getting Start&lt;/h2&gt;
&lt;p&gt;Grab the &lt;code&gt;QRss&lt;/code&gt; class and use require it in your php file.&lt;/p&gt;
&lt;div class="highlight highlight-text-html-php notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;require&lt;/span&gt; &lt;span class="pl-s"&gt;'src/QRss.php'&lt;/span&gt;;

&lt;span class="pl-c"&gt;// To fetch an RSS feed as json use&lt;/span&gt;
(&lt;span class="pl-k"&gt;new&lt;/span&gt; &lt;span class="pl-v"&gt;Qrss&lt;/span&gt;(&lt;span class="pl-s"&gt;'https://news.google.com/?output=rss'&lt;/span&gt;))-&amp;gt;&lt;span class="pl-en"&gt;json&lt;/span&gt;();

&lt;span class="pl-c"&gt;// For fresh copy you can use fresh() which will ignore cache&lt;/span&gt;
(&lt;span class="pl-k"&gt;new&lt;/span&gt; &lt;span class="pl-v"&gt;Qrss&lt;/span&gt;(&lt;span class="pl-s"&gt;'https://news.google.com/?output=rss'&lt;/span&gt;))-&amp;gt;&lt;span class="pl-en"&gt;fresh&lt;/span&gt;()-&amp;gt;&lt;span class="pl-en"&gt;json&lt;/span&gt;()

&lt;span class="pl-c"&gt;// Get the feed ignoring validation adding novalidate()&lt;/span&gt;
(&lt;span class="pl-k"&gt;new&lt;/span&gt; &lt;span class="pl-v"&gt;QRss&lt;/span&gt;(&lt;span class="pl-s"&gt;'https://en.blog.wordpress.com/feed/'&lt;/span&gt;))-&amp;gt;&lt;span class="pl-en"&gt;novalidate&lt;/span&gt;()-&amp;gt;&lt;span class="pl-en"&gt;json&lt;/span&gt;();

&lt;span class="pl-c"&gt;// There is also an option to get data in plain text using text() instead of json()&lt;/span&gt;
(&lt;span class="pl-k"&gt;new&lt;/span&gt; &lt;span class="pl-v"&gt;Qrss&lt;/span&gt;(&lt;span class="pl-s"&gt;'https://news.google.com/?output=rss'&lt;/span&gt;))-&amp;gt;&lt;span class="pl-en"&gt;text&lt;/span&gt;();&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
Override Parser&lt;/h2&gt;
&lt;p&gt;You can also extend the parse method to customize the output.&lt;/p&gt;
&lt;div class="highlight highlight-text-html-php notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;class&lt;/span&gt; &lt;span class="pl-v"&gt;MyQrss&lt;/span&gt; &lt;span class="pl-k"&gt;extends&lt;/span&gt; &lt;span class="pl-v"&gt;QRss&lt;/span&gt; {
     &lt;span class="pl-k"&gt;protected&lt;/span&gt; &lt;span class="pl-k"&gt;function&lt;/span&gt; &lt;span class="pl-en"&gt;parse&lt;/span&gt;(&lt;span class="pl-s1"&gt;&lt;span class="pl-c1"&gt;$&lt;/span&gt;xml&lt;/span&gt;)
     {
         &lt;span class="pl-c"&gt;// you have all the xml elements as SimpleXMLElement object&lt;/span&gt;
         &lt;span class="pl-c"&gt;//&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/saqueib/qrss"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  How to make them talk ?
&lt;/h3&gt;

&lt;p&gt;For this I use AJAX. So when you open the application on your mobile, it trigger the AJAX which send a request to the server. The server responds with the JSON.&lt;/p&gt;

&lt;p&gt;All I had to do was to loop over the JSON and append them to the List View of my application in order for it to display.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploy APK
&lt;/h3&gt;

&lt;p&gt;I used Adobe PhoneGap Build for compiling the files and generate the APK, hence I downloaded the APK and installed it on my mobile phone.&lt;/p&gt;

&lt;p&gt;Done !!! Works completely fine..&lt;/p&gt;

&lt;p&gt;Below is the link of the app, just in case someone wants to check it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://drive.google.com/open?id=1j5H20zifoI7lQ6Fbh_xQOLVso9nBwysn"&gt;Google Drive Link&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>jquerymobile</category>
      <category>xml</category>
      <category>json</category>
      <category>phonegap</category>
    </item>
    <item>
      <title>Using codeigniter 3 CAPTCHA helper in forms</title>
      <dc:creator>fadilxcoder</dc:creator>
      <pubDate>Thu, 17 Jan 2019 11:06:59 +0000</pubDate>
      <link>https://dev.to/fadilxcoder/using-codeigniter-3-captcha-helper-in-forms-gjl</link>
      <guid>https://dev.to/fadilxcoder/using-codeigniter-3-captcha-helper-in-forms-gjl</guid>
      <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I will show you a very simple way to use codeigniter 3 CAPTCHA helper when submitting a form in your web application.&lt;/p&gt;

&lt;h2&gt;
  
  
  So... Ready, Set, Code !
&lt;/h2&gt;

&lt;p&gt;For this, we will be using Welcome controller and welcome_message view. So the first step is to edit the code in the "&lt;strong&gt;index&lt;/strong&gt;" method in "&lt;strong&gt;Welcome&lt;/strong&gt;" controller and add 3 things.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'form_validation'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;helper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'captcha'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'session'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;We load the form validation library in order validate the data when the user submit a form on the webpage.&lt;/li&gt;
&lt;li&gt;We load the captcha helper that we will configure afterwards.&lt;/li&gt;
&lt;li&gt;We will be using the session library in order to store the captcha value.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now we will have to configure the CAPTCHA helper&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="nv"&gt;$vals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="s1"&gt;'word'&lt;/span&gt;          &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;rand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;999999&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="s1"&gt;'img_path'&lt;/span&gt;      &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'./assets/captcha/images/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="s1"&gt;'img_url'&lt;/span&gt;       &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;base_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'assets'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;'/captcha/images/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="s1"&gt;'font_path'&lt;/span&gt;     &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;base_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'assets'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;'/captcha/fonts/XYZ.ttf'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="s1"&gt;'img_width'&lt;/span&gt;     &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'150'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="s1"&gt;'img_height'&lt;/span&gt;    &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="s1"&gt;'word_length'&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="s1"&gt;'colors'&lt;/span&gt;        &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
               &lt;span class="s1"&gt;'background'&lt;/span&gt;     &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
               &lt;span class="s1"&gt;'border'&lt;/span&gt;         &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
               &lt;span class="s1"&gt;'text'&lt;/span&gt;           &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
               &lt;span class="s1"&gt;'grid'&lt;/span&gt;           &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  IMPORTANT NOTICE !
&lt;/h3&gt;

&lt;p&gt;I forgot to mention before, you will have to set your project file structure as below if your configuration is like above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your_ci_project
│
└───application
│
└───system
│
└───tests
│
└───index.php
│
└───.htaccess
│
└───assets
    │
    └───captcha
           │
           └───images
           │
           └───fonts
                 │
                 └───XYZ.ttf

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can find more details on &lt;a href="https://www.codeigniter.com/user_guide/helpers/captcha_helper.html"&gt;Codeigniter User Guide &lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After configuring it, call the function that will create the captcha and finally sending it to the "&lt;strong&gt;welcome_message.php&lt;/strong&gt;" view.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'captcha'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_captcha&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$vals&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;view&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'welcome_message'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see the captcha in your view, just add this piece of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$captcha&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'image'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope everything is okay till now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time to validate !
&lt;/h2&gt;

&lt;p&gt;In this part we will code the part where the user click on a submit button on the webpage and the controller will validate the captcha.&lt;/p&gt;

&lt;p&gt;Let say we have a form in our view with a button in it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php echo $captcha['image'] ?&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"captcha"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"hidden"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;?php echo $captcha['word'] ?&amp;gt;"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"code"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"submit_contact"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Send&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see in the above code, I have a input tag of type hidden whereby I stored the captcha string and when submitting the form, this data is also sent to the controller.&lt;/p&gt;

&lt;p&gt;In order to avoid creating multiple methods, I will use the &lt;strong&gt;index&lt;/strong&gt; one but will add an &lt;strong&gt;if/else&lt;/strong&gt; conditional statement to check if a user submit a form. After that we will process the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;isset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'submit_contact'&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
   &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;set_userdata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'captcha_answer'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'code'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
   &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;form_validation&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;set_rules&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'captcha'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Captcha'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'required|integer|callback_check_captcha'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;form_validation&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;TRUE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
      &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;set_flashdata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'positive'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s1"&gt;'CAPTCHA VALIDATED SUCCESSFULLY'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;site_url&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
   &lt;span class="k"&gt;endif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;endif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see above, there is a callback for the submitted captcha in order to check whether it is the same or not as in the image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;check_captcha&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$string&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;userdata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'captcha_answer'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
      &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;form_validation&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;set_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'check_captcha'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'captcha incorrect'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
   &lt;span class="k"&gt;endif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, if you want you can destroy the session for &lt;strong&gt;captcha_answer&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That's it!&lt;/p&gt;

</description>
      <category>codeigniter</category>
      <category>captcha</category>
      <category>helper</category>
      <category>form</category>
    </item>
    <item>
      <title>Adding multi-language functionality in a website developed in laravel.</title>
      <dc:creator>fadilxcoder</dc:creator>
      <pubDate>Sat, 05 Jan 2019 16:58:38 +0000</pubDate>
      <link>https://dev.to/fadilxcoder/adding-multi-language-functionality-in-a-website-developed-in-laravel-4ech</link>
      <guid>https://dev.to/fadilxcoder/adding-multi-language-functionality-in-a-website-developed-in-laravel-4ech</guid>
      <description>&lt;p&gt;Hello Everyone,&lt;br&gt;
Today I will share with you how do add multi language to a website that was developed in laravel, my version is &lt;strong&gt;5.6&lt;/strong&gt; but it will work on &lt;strong&gt;5.7&lt;/strong&gt; as well.&lt;/p&gt;
&lt;h2&gt;
  
  
  So...here we go!
&lt;/h2&gt;

&lt;p&gt;First of all, I assume that you already have a working version of laravel. Navigate to that particular folder and open your terminal or command prompt.&lt;/p&gt;

&lt;p&gt;Run the following command in order to create the required middleware.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ php artisan make:middleware Localization

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then open it. The file should be in "&lt;strong&gt;&lt;em&gt;project_name/app/Http/Middleware/Localization.php&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;

&lt;p&gt;Update the code that is present with the one below :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;Closure&lt;/span&gt; &lt;span class="nv"&gt;$next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;Session&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'locale'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;App&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nb"&gt;setlocale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;Session&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'locale'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Lets say you want your website to be in &lt;strong&gt;&lt;em&gt;English&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;French&lt;/em&gt;&lt;/strong&gt;.
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to "&lt;strong&gt;&lt;em&gt;project_name/resources/lang/en/&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a file name "&lt;strong&gt;&lt;em&gt;messages.php&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create folder "&lt;strong&gt;&lt;em&gt;fr&lt;/em&gt;&lt;/strong&gt;" in "&lt;strong&gt;&lt;em&gt;project_name/resources/lang/&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a file name "&lt;strong&gt;&lt;em&gt;messages.php&lt;/em&gt;&lt;/strong&gt;" in "&lt;strong&gt;&lt;em&gt;project_name/resources/lang/fr/&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Open "&lt;strong&gt;&lt;em&gt;messages.php&lt;/em&gt;&lt;/strong&gt;" in both folder and insert the following codes.&lt;/p&gt;

&lt;h4&gt;
  
  
  "&lt;strong&gt;&lt;em&gt;messages.php&lt;/em&gt;&lt;/strong&gt;" in '&lt;strong&gt;en&lt;/strong&gt;' folder.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'welcome'&lt;/span&gt;       &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Welcome to our application'&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  "&lt;strong&gt;&lt;em&gt;messages.php&lt;/em&gt;&lt;/strong&gt;" in '&lt;strong&gt;fr&lt;/strong&gt;' folder.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'welcome'&lt;/span&gt;       &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Bienvenue sur notre application'&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Most important...
&lt;/h2&gt;

&lt;p&gt;Add the below codes in "&lt;strong&gt;&lt;em&gt;project_name/app/Http/Kernel.php&lt;/em&gt;&lt;/strong&gt;" in "&lt;em&gt;protected $middlewareGroups&lt;/em&gt; section".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;App\Http\Middleware\Localization&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So your codes should be like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$middlewareGroups&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'web'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;App\Http\Middleware\EncryptCookies&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;Illuminate\Session\Middleware\StartSession&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="c1"&gt;// \Illuminate\Session\Middleware\AuthenticateSession::class,&lt;/span&gt;
            &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;Illuminate\View\Middleware\ShareErrorsFromSession&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;App\Http\Middleware\VerifyCsrfToken&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;Illuminate\Routing\Middleware\SubstituteBindings&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nc"&gt;App\Http\Middleware\Localization&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;

        &lt;span class="s1"&gt;'api'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'throttle:60,1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'bindings'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now all this code in the route, "&lt;strong&gt;&lt;em&gt;project_name/routes/web.php&lt;/em&gt;&lt;/strong&gt;" on top of other defined routes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'locale/{locale}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$locale&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nc"&gt;Session&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'locale'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$locale&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;back&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So in order to know the language that is being use, you can simply use :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"{{ app()-&amp;gt;getLocale() }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Changing language en/fr
&lt;/h2&gt;

&lt;p&gt;To change the language, just create an anchor tag in html like the following :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ url('locale/en') }}"&lt;/span&gt; &lt;span class="nt"&gt;&amp;gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"fa fa-language"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/i&amp;gt;&lt;/span&gt; EN&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"{{ url('locale/fr') }}"&lt;/span&gt; &lt;span class="nt"&gt;&amp;gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"fa fa-language"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/i&amp;gt;&lt;/span&gt; FR&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To call the desired text :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;{{ __('messages.welcome') }}&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>laravel</category>
      <category>multilanguage</category>
      <category>localization</category>
      <category>middleware</category>
    </item>
  </channel>
</rss>
