<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">

<channel>
	<title>InimistTech Blogs</title>
	<atom:link href="https://devarticles.in/feed/" rel="self" type="application/rss+xml"/>
	<link>https://devarticles.in/</link>
	<description>Web &amp; Mobile App Tech Weblog</description>
	<lastBuildDate>Sun, 25 Jan 2026 08:35:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://devarticles.in/wp-content/uploads/2019/09/cropped-favicon-2-1-32x32.png</url>
	<title>InimistTech Blogs</title>
	<link>https://devarticles.in/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">7428851</site>	<itunes:explicit>no</itunes:explicit><itunes:subtitle>Web &amp; Mobile App Tech Weblog</itunes:subtitle><item>
		<title>Fix- Navigating to a screen outside of current Navigation Stack in React Native and Expo</title>
		<link>https://devarticles.in/navigating-to-a-screen-outside-of-current-stack-nagivator-in-react-native/</link>
					<comments>https://devarticles.in/navigating-to-a-screen-outside-of-current-stack-nagivator-in-react-native/#respond</comments>
		
		<dc:creator><![CDATA[Arvind Kumar]]></dc:creator>
		<pubDate>Sun, 25 Jan 2026 08:35:51 +0000</pubDate>
				<category><![CDATA[ReactNative]]></category>
		<category><![CDATA[commonactions]]></category>
		<category><![CDATA[navigator]]></category>
		<category><![CDATA[nested stack]]></category>
		<category><![CDATA[react navigation]]></category>
		<category><![CDATA[stack navigator]]></category>
		<category><![CDATA[usenavigation]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10369</guid>

					<description><![CDATA[<p>Before updating ReactNative version to 0.81.5 from 0.77 the following code to navigate bewteen screens stopped working. const { navigation } = props; navigation.navigate( 'Gift Codes' ) The Gift Code screen was a part of different navigation stack named BottomTabNavigator&#8230;</p>
<p><a href="https://devarticles.in/navigating-to-a-screen-outside-of-current-stack-nagivator-in-react-native/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/navigating-to-a-screen-outside-of-current-stack-nagivator-in-react-native/">Fix- Navigating to a screen outside of current Navigation Stack in React Native and Expo</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Before updating ReactNative version to 0.81.5 from 0.77 the following code to navigate bewteen screens stopped working.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">const { navigation } = props;
navigation.navigate(
  'Gift Codes'
)</pre>
<p>The <code>Gift Code</code> screen was a part of different navigation stack named <code>BottomTabNavigator</code> and rendered parallel to the <code>RedeemScreenStack</code> from one of the screens of which I needed to navigate to &#8220;Gift Codes&#8221; screen which one of the screens in <code>BottomTabNavigator</code> stack. So to repeat the code above worked before but not after the upgrade.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-10370" src="https://devarticles.in/wp-content/uploads/2026/01/react-navigation-to-stack-navigator-stack-nested.png" alt="" width="1400" height="650" srcset="https://devarticles.in/wp-content/uploads/2026/01/react-navigation-to-stack-navigator-stack-nested.png 1400w, https://devarticles.in/wp-content/uploads/2026/01/react-navigation-to-stack-navigator-stack-nested-300x139.png 300w, https://devarticles.in/wp-content/uploads/2026/01/react-navigation-to-stack-navigator-stack-nested-1024x475.png 1024w, https://devarticles.in/wp-content/uploads/2026/01/react-navigation-to-stack-navigator-stack-nested-768x357.png 768w" sizes="(max-width: 1400px) 100vw, 1400px" /></p>
<p>In order to make it work, the following code was incorporated instead.</p>
<p>First of all import &#8220;CommonActions&#8221; and &#8220;useNavigation&#8221; component libraries of react-navigation/native library.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import { CommonActions, useNavigation } from '@react-navigation/native';
</pre>
<p>In the main functional component extract &#8220;useNavigation&#8221; for handling navigation actions.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">const OrderPlacedScreen = () =&gt; {
  ......
  const navigation = useNavigation();
  ......
}</pre>
<p>And finally call <code>reset</code> method of &#8220;CommonActions&#8221; functional class.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">navigation.dispatch(
  CommonActions.reset({
    index: 0,
    routes: [{ 
      name: 'BottomTabNavigator',
      state: {
        routes: [
          {
            name: 'Gift Codes',
          }
        ]
      }
    }],
  })
)</pre>
<p>Remember that using reset method we inside deeply nested routes and screens. We just need to repeat using the <code>name</code> and <code>state</code> in a nested manner.</p>
<p>I hope it helps someone.</p>
<p>The post <a href="https://devarticles.in/navigating-to-a-screen-outside-of-current-stack-nagivator-in-react-native/">Fix- Navigating to a screen outside of current Navigation Stack in React Native and Expo</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/navigating-to-a-screen-outside-of-current-stack-nagivator-in-react-native/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10369</post-id>	</item>
		<item>
		<title>Slick Slider WordPress Without Plugin | Slick Carousel</title>
		<link>https://devarticles.in/slick-slider-wordpress-without-plugin-slick-carousel/</link>
					<comments>https://devarticles.in/slick-slider-wordpress-without-plugin-slick-carousel/#respond</comments>
		
		<dc:creator><![CDATA[Monika Thakur]]></dc:creator>
		<pubDate>Thu, 27 Nov 2025 11:32:46 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Photoshop]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10357</guid>

					<description><![CDATA[<p>The Slick Slider library is a solid option for displaying slideshows on your website, and my go-to solution the majority of the time. In this post, I&#8217;ll show you how to set it up for your next project. Being a&#8230;</p>
<p><a href="https://devarticles.in/slick-slider-wordpress-without-plugin-slick-carousel/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/slick-slider-wordpress-without-plugin-slick-carousel/">Slick Slider WordPress Without Plugin | Slick Carousel</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The Slick Slider library is a solid option for displaying slideshows on your website, and my go-to solution the majority of the time. In this post, I&#8217;ll show you how to set it up for your next project.</p>
<p>Being a developer, I personally hate slider plugins. In my opinion, they give you so many options that you end up not being able to maintain them without having to do all kinds of magic.</p>
<p><img decoding="async" class="alignnone size-full wp-image-10358" src="https://devarticles.in/wp-content/uploads/2025/11/Slick-Slider-WordPress-Without-Plugin.jpg" alt="" width="1000" height="600" srcset="https://devarticles.in/wp-content/uploads/2025/11/Slick-Slider-WordPress-Without-Plugin.jpg 1000w, https://devarticles.in/wp-content/uploads/2025/11/Slick-Slider-WordPress-Without-Plugin-300x180.jpg 300w, https://devarticles.in/wp-content/uploads/2025/11/Slick-Slider-WordPress-Without-Plugin-768x461.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></p>
<h2><strong>Step One: Download Slick Carousel files:</strong></h2>
<p>Create directories called &#8220;assets,&#8221; &#8220;src,&#8221; and &#8220;library&#8221; in the root of your project in the following order. Your-theme &gt; assets &gt; src &gt; library<br />
Create two more directories inside the library called css and js</p>
<ul>
<li>Copy the JS from the downloaded file and place it inside the JS folder.</li>
<li>Copy the CSS and slick-theme.css and place them inside the CSS folder.</li>
<li>Create another directory called carousel inside assets/src and create a file called js</li>
</ul>
<p>&nbsp;</p>
<h2><strong>Step Two: Enqueue the files</strong></h2>
<p>Now, go to your functions.php file in your theme and add the functions to enqueue the files.</p>
<p>Function custom_theme_enqueue_styles() {</p>
<pre class="EnlighterJSRAW" data-enlighter-language="css">wp_enqueue_style('slick-css', get_stylesheet_directory_uri().'/css/slick.css');
    wp_enqueue_script('slick-js', get_stylesheet_directory_uri() . '/js/slick.js', array( 'jquery' ), '1.0', true );
}
add_action('wp_enqueue_scripts', 'custom_theme_enqueue_styles');
</pre>
<h2><strong>Step Three: Add HTML for carousel</strong></h2>
<p>Now, let&#8217;s add the HTML markup for the carousel in the template file where you want the carousel (let&#8217;s say index.php )</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;div class="posts-carousel px-5"&gt;
   &lt;!--Slide One--&gt;
   &lt;div class="card"&gt;
      &lt;img width="350" height="233" src="https://via.placeholder.com/150" class="w-100" alt="alt-text"&gt;
      &lt;div class="card-body"&gt;
         &lt;h3 class="card-title"&gt;Your Post heading&lt;/h3&gt;
         &lt;p&gt;Your Post Excerpt&lt;/p&gt;
         &lt;a href="#" class="btn btn-primary"&gt;View More&lt;/a&gt;
      &lt;/div&gt;
   &lt;/div&gt;
   &lt;!--Slide Two--&gt;
   &lt;div class="card"&gt;
      &lt;img width="350" height="233" src="https://via.placeholder.com/150" class="w-100" alt="alt-text"&gt;
      &lt;div class="card-body"&gt;
         &lt;h3 class="card-title"&gt;Your Post heading&lt;/h3&gt;
         &lt;p&gt;Your Post Excerpt&lt;/p&gt;
         &lt;a href="#" class="btn btn-primary"&gt;View More&lt;/a&gt;
      &lt;/div&gt;
   &lt;/div&gt;
&lt;/div&gt;
If you want to loop through a default post or a Custom post type articles you can put this inside a loop.
$args = [
   'posts_per_page'         =&gt; 5,
   'post_type'              =&gt; 'post',
   'update_post_meta_cache' =&gt; false,
   'update_post_term_cache' =&gt; false,
];

$post_query = new \WP_Query( $args );
?&gt;
&lt;div class="posts-carousel px-5"&gt;
   &lt;?php
   if ( $post_query-&gt;have_posts() ) :
      while ( $post_query-&gt;have_posts() ) :
         $post_query-&gt;the_post();
         ?&gt;
         &lt;div class="card"&gt;
            &lt;?php
            if ( has_post_thumbnail() ) {
               the_post_custom_thumbnail(
                  get_the_ID(),
                  'featured-thumbnail',
                  [
                     'sizes' =&gt; '(max-width: 350px) 350px, 233px',
                     'class' =&gt; 'w-100',
                  ]
               );
            } else {
               ?&gt;
               &lt;img src="https://via.placeholder.com/510x340" class="w-100" alt="Card image cap"&gt;
               &lt;?php
            }
            ?&gt;
            &lt;div class="card-body"&gt;
               &lt;?php the_title( '&lt;h3 class="card-title"&gt;', '&lt;/h3&gt;' ); ?&gt;
               &lt;?php the_excerpt(); ?&gt;
               &lt;a href="&lt;?php echo esc_url( get_the_permalink() ); ?&gt;" class="btn btn-primary"&gt;
                  &lt;?php esc_html_e( 'View More', 'aquila' ); ?&gt;
               &lt;/a&gt;
            &lt;/div&gt;
         &lt;/div&gt;
      &lt;?php
      endwhile;
   endif;
   wp_reset_postdata();
   ?&gt;
&lt;/div&gt;
</pre>
<p>Let’s initialize the carousel by calling the .slick() and passing the parent class name of our carousel container as a selector. Notice that the carousel container name is posts-carousel; hence, the selector will be posts-carousel, and the function will be called like so: $(&#8216;.posts-carousel&#8217;).slick()</p>
<p>We are also passing the settings for the carousel inside the slick()</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">( function( $ ) {
  class SlickCarousel {
    constructor() {
      this.initiateCarousel();
    }
    initiateCarousel() {
      $( '.posts-carousel' ).slick( {
        autoplay: true,
        autoplaySpeed: 1000,
        slidesToShow: 3,
        slidesToScroll: 1,
      } );
    }
  }
  new SlickCarousel();
} )( jQuery );


</pre>
<h2><strong>Step Four: Initialise the carousel</strong></h2>
<p>Let’s initialise the carousel by calling the .slick() and passing the parent class name of our carousel container as a selector. Notice that the carousel container name is posts-carousel, hence the selector will be posts-carousel and the function will be called like so : $(&#8216;.posts-carousel&#8217;).slick()</p>
<p>We are also passing the settings for the carousel inside the slick()</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">( function( $ ) {
  class SlickCarousel {
    constructor() {
      this.initiateCarousel();
    }
    initiateCarousel() {
      $( '.posts-carousel' ).slick( {
        autoplay: true,
        autoplaySpeed: 1000,
        slidesToShow: 3,
        slidesToScroll: 1,
      } );
    }
  }
  new SlickCarousel();
} )( jQuery );

</pre>
<p>Also read :-<br />
<a href="https://devarticles.in/using-context-api-to-create-text-alert-or-notification-at-the-top-of-a-page/">Using Context API to create text alert or notification at the top of a page</a></p>
<p>The post <a href="https://devarticles.in/slick-slider-wordpress-without-plugin-slick-carousel/">Slick Slider WordPress Without Plugin | Slick Carousel</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/slick-slider-wordpress-without-plugin-slick-carousel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10357</post-id>	</item>
		<item>
		<title>Using Context API to create text alert or notification at the top of a page</title>
		<link>https://devarticles.in/using-context-api-to-create-text-alert-or-notification-at-the-top-of-a-page/</link>
					<comments>https://devarticles.in/using-context-api-to-create-text-alert-or-notification-at-the-top-of-a-page/#respond</comments>
		
		<dc:creator><![CDATA[Neetu Kaur]]></dc:creator>
		<pubDate>Sun, 05 Oct 2025 16:57:58 +0000</pubDate>
				<category><![CDATA[Miscelleneous]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10329</guid>

					<description><![CDATA[<p>In modern React applications, showing success or error messages after a user action (like form submission or data saving) improves the user experience.Instead of repeating the same notification code in every component, we can centralize it using React Context API&#8230;</p>
<p><a href="https://devarticles.in/using-context-api-to-create-text-alert-or-notification-at-the-top-of-a-page/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/using-context-api-to-create-text-alert-or-notification-at-the-top-of-a-page/">Using Context API to create text alert or notification at the top of a page</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In modern React applications, showing success or error messages after a user action (like form submission or data saving) improves the user experience.<br data-start="473" data-end="476" />Instead of repeating the same notification code in every component, we can <strong data-start="551" data-end="565">centralize</strong> it using <strong data-start="575" data-end="596">React Context API</strong> — a powerful feature for managing global state without external libraries like Redux.</p>
<p><img decoding="async" class="alignnone size-full wp-image-10350" src="https://devarticles.in/wp-content/uploads/2025/10/react-notification-using-context-api.gif" alt="" width="816" height="528" /></p>
<p>In this tutorial, we’ll build a simple but reusable <strong data-start="736" data-end="759">notification system</strong> that displays messages (Success / Error) at the top of the page.</p>
<h3 data-start="831" data-end="851">Project Setup</h3>
<p>Let’s start by creating a React + TypeScript project.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="beyond">npx create-vite@latest notifyapp
cd notifyapp
npm install @heroicons/react</pre>
<p>We’ll use <strong data-start="1026" data-end="1042">Tailwind CSS</strong> for styling (optional but recommended).</p>
<p>Follow Tailwind setup guide from:</p>
<p><a class="decorated-link" href="https://tailwindcss.com/docs/guides/create-react-app" target="_new" rel="noopener" data-start="1123" data-end="1231">https://tailwindcss.com/docs/guides/create-react-app</a></p>
<p><img loading="lazy" decoding="async" class="wp-image-10341 aligncenter" src="https://devarticles.in/wp-content/uploads/2025/10/ChatGPT-Image-Oct-13-2025-03_02_29-PM-300x200.png" alt="" width="452" height="301" srcset="https://devarticles.in/wp-content/uploads/2025/10/ChatGPT-Image-Oct-13-2025-03_02_29-PM-300x200.png 300w, https://devarticles.in/wp-content/uploads/2025/10/ChatGPT-Image-Oct-13-2025-03_02_29-PM-1024x683.png 1024w, https://devarticles.in/wp-content/uploads/2025/10/ChatGPT-Image-Oct-13-2025-03_02_29-PM-768x512.png 768w, https://devarticles.in/wp-content/uploads/2025/10/ChatGPT-Image-Oct-13-2025-03_02_29-PM.png 1536w" sizes="auto, (max-width: 452px) 100vw, 452px" /></p>
<p>Step 1: Create Flash Context:</p>
<p>File: <strong data-start="1474" data-end="1501"><code data-start="1476" data-end="1499">src/context/flash.tsx</code></strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="beyond">import React from 'react';

type FlashProviderPropType = {
  children: React.ReactNode;
};

const defaultMessage = {
  type: "",
  message: ""
}

type MessagePropType = {
  type?: "info"|"success"|"error";
  message: string|string[]
}|null;

interface Flash {
  message: MessagePropType,
  setFlash: React.Dispatch&lt;React.SetStateAction&lt;MessagePropType&gt;&gt;
}

const FlashContext = React.createContext&lt;Flash&gt;({} as Flash);

const FlashProvider: React.FC&lt;FlashProviderPropType&gt; = ({ children }) =&gt; {
  const [message, setFlash] = React.useState(defaultMessage as MessagePropType);
  return (
    
    &lt;FlashContext.Provider value={{ message, setFlash }}&gt;
      {children}
    &lt;/FlashContext.Provider&gt;
  );
};

export { FlashContext, FlashProvider };
</pre>
<p><strong data-start="2270" data-end="2286">Explanation:</strong></p>
<ul data-start="2288" data-end="2592">
<li data-start="2288" data-end="2388">We define a global <code data-start="2309" data-end="2323">FlashContext</code> to share the current notification message and a setter function.</li>
<li data-start="2389" data-end="2460">The provider wraps our app so any component can show a flash message.</li>
<li data-start="2461" data-end="2592">The <code data-start="2467" data-end="2476">message</code> has two properties:
<ul data-start="2499" data-end="2592">
<li data-start="2499" data-end="2530"><code data-start="2501" data-end="2507">type</code>: <code data-start="2509" data-end="2530">"success" | "error"</code></li>
<li data-start="2533" data-end="2592"><code data-start="2535" data-end="2544">message</code>: can be a string or an array of error messages.<br />
<h3 data-start="2599" data-end="2647">Step 2: Create the Notification Component</h3>
<p>File: <strong data-start="2655" data-end="2685"><code data-start="2657" data-end="2683">src/components/flash.tsx</code></strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="beyond">import React from 'react'
import { FlashContext } from "../context/flash";

import { CheckCircleIcon } from '@heroicons/react/20/solid'
import { XCircleIcon } from '@heroicons/react/20/solid'

const Flash = () =&gt; {
  const { message, setFlash } = React.useContext(FlashContext);
  React.useEffect(
    () =&gt; {
      const timer1 = setTimeout(() =&gt; setFlash(null), 4000);
      return () =&gt; {
        clearTimeout( timer1 );
      }
    },
    [setFlash, message]
  )

  if( !message || !message?.message )    {
    return null;
  }

  if( !message?.type ) {
    message.type = "success"
  }


  const Success = () =&gt; {
    return (
      &lt;div className="rounded-md bg-green-50 p-2"&gt;
      &lt;div className="flex max-w-lg mx-auto items-center"&gt;
        &lt;div className="shrink-0"&gt;
          &lt;CheckCircleIcon aria-hidden="true" className="size-5 text-green-400" /&gt;
        &lt;/div&gt;
        &lt;div className="text-left align-middle pl-1"&gt;
          &lt;h3 className="text-sm font-medium text-green-800"&gt;{message.message}&lt;/h3&gt;
        &lt;/div&gt;
        &lt;div className="shrink-0 ml-auto"&gt;
          &lt;button
            type="button"
            className="ml-3 rounded-md px-2 py-0 text-xs font-normal text-green-800 bg-green-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600"
            onClick={()=&gt;setFlash(null)}
          &gt;
            Dismiss
          &lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    )
  }

  const Error = () =&gt; {
    let errors: string[] = [];
    // console.log("message.message typeof", typeof message.message)
    if(typeof message.message === 'object' &amp;&amp; message.message.length &gt; 0 )  {
      errors = message.message;
    } else if(typeof message.message === 'string') errors.push(message.message)
    return (
      &lt;div className="rounded-md bg-red-50 p-2"&gt;
      &lt;div className="flex items-start max-w-lg mx-auto"&gt;
        &lt;div className="shrink-0 items-start"&gt;
          &lt;XCircleIcon aria-hidden="true" className="size-5 text-red-400" /&gt;
        &lt;/div&gt;
        &lt;div className="text-left align-middle pl-1"&gt;
          &lt;h3 className="text-sm font-medium text-red-800"&gt;There were {errors.length} errors with your submission&lt;/h3&gt;
          &lt;div className="mt-2 text-sm text-red-700"&gt;
            &lt;ul role="list" className="list-disc space-y-1 pl-5"&gt;
            {errors.map((value, index) =&gt; &lt;li key={`err-${index}`}&gt;{value}&lt;/li&gt;)}
            &lt;/ul&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div className="shrink-0 ml-auto"&gt;
          &lt;button
            type="button"
            className="ml-3 rounded-md px-2 py-0 text-xs font-normal text-red-800 bg-red-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600"
            onClick={()=&gt;setFlash(null)}
          &gt;
            Dismiss
          &lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    )
  }

  return (
    &lt;div className="fixed top-0 right-0 left-0 text-center z-100"&gt;
      {message.type === 'success' &amp;&amp; &lt;Success /&gt;}
      {message.type === 'error' &amp;&amp; &lt;Error /&gt;}
    &lt;/div&gt;
  )
}

export default Flash</pre>
<p><strong data-start="4967" data-end="4982">Key Points:</strong></p>
<ul data-start="4984" data-end="5223">
<li data-start="4984" data-end="5037">This component listens to the <code data-start="5016" data-end="5030">FlashContext</code> state.</li>
<li data-start="5038" data-end="5084">It automatically disappears after 4 seconds.</li>
<li data-start="5085" data-end="5141">You can manually dismiss it with the “Dismiss” button.</li>
<li data-start="5142" data-end="5223">Two inner components handle different message types: <strong data-start="5197" data-end="5208">Success</strong> and <strong data-start="5213" data-end="5222">Error</strong>.<br />
<h3 data-start="5230" data-end="5282">Step 3: Create a Page to Trigger Notifications</h3>
<p>File: <strong data-start="5290" data-end="5315"><code data-start="5292" data-end="5313">src/pages/index.tsx</code></strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import React from "react";
import { FlashContext } from "../context/flash";


export default function Dashboard() {

    const { setFlash } = React.useContext(FlashContext);
    return (
        &lt;div className="p-25 flex justify-center"&gt;
            &lt;p&gt;&lt;a className='rounded-md bg-indigo-600 px-3 py-2 text-center text-sm font-semibold text-white' onClick={() =&gt; {
                setFlash({ message: "Something was done", 'type': "success" })
            }}&gt;Set Success&lt;/a&gt; &lt;a className='rounded-md bg-indigo-600 px-3 py-2 text-center text-sm font-semibold text-white' onClick={() =&gt; {
                setFlash({ message: "Something was wrong", 'type': "error" })
            }}&gt;Set Error&lt;/a&gt;&lt;/p&gt;
        &lt;/div&gt;
    )
}
</pre>
<p>When a user clicks one of these buttons, it updates the <strong data-start="6158" data-end="6174">FlashContext</strong>, which automatically triggers the <code data-start="6209" data-end="6216">Flash</code> component at the top of the screen.</p>
<h3 data-start="6259" data-end="6307">Step 4: Wrap the App with <code data-start="6292" data-end="6307">FlashProvider</code></h3>
<p>File: <strong data-start="6315" data-end="6332"><code data-start="6317" data-end="6330">src/App.tsx</code></strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import './App.css'
import Flash from './components/flash'
import { FlashProvider } from './context/flash'
import Dashboard from './pages'

function App() {

  return (
    &lt;&gt;
      &lt;FlashProvider&gt;
          &lt;AppWrapper /&gt;
        &lt;/FlashProvider&gt;
    &lt;/&gt;
  )
}

export default App

const AppWrapper = () =&gt; {
  return (
    &lt;div className="app-wrapper lg:min-w-[1024px]"&gt;
      &lt;Dashboard /&gt;
      &lt;Flash /&gt;
    &lt;/div&gt;
  )
}</pre>
<ul data-start="1255" data-end="1426">
<li data-start="1255" data-end="1348">The <code data-start="1261" data-end="1276">FlashProvider</code> makes the <code data-start="1287" data-end="1301">FlashContext</code> available <strong data-start="1312" data-end="1345">throughout the component tree</strong>.</li>
<li data-start="1349" data-end="1426">Any child (like <code data-start="1367" data-end="1378">Dashboard</code>) can now call <code data-start="1393" data-end="1405">setFlash()</code> to display messages.</li>
<li data-start="1349" data-end="1426"><code data-start="2071" data-end="2076">App</code> only handles context setup, not UI.</li>
<li data-start="1349" data-end="1426"><strong data-start="2117" data-end="2137">Reusable Wrapper</strong> –  easily add more global providers (like AuthProvider or ThemeProvider)</li>
<li data-start="1349" data-end="1426"><strong data-start="2229" data-end="2257">Consistent Notifications</strong> – The <code data-start="2264" data-end="2271">Flash</code> component always stays at the top level, so it’s visible on every page.</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>I have already implemented this notification system in my React project and hosted it on CodeSandbox for reference.<br />
You can explore the full source code and live preview using the following link:</p>
<p><strong>Working Codesandbox</strong>: <a href="https://codesandbox.io/p/github/InimistTechnologies/react-notification/master">https://codesandbox.io/p/github/InimistTechnologies/react-notification/master</a> (see blow)<br />
<strong>Github Repo</strong>: <a href="https://github.com/InimistTechnologies/react-notification">https://github.com/InimistTechnologies/react-notification</a></p>
<p><iframe style="width: 100%; height: 500px; border: 0; border-radius: 4px; overflow: hidden;" title="InimistTechnologies/react-notification/master" src="https://codesandbox.io/p/github/InimistTechnologies/react-notification/master?embed=1" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe></p>
<p>The post <a href="https://devarticles.in/using-context-api-to-create-text-alert-or-notification-at-the-top-of-a-page/">Using Context API to create text alert or notification at the top of a page</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/using-context-api-to-create-text-alert-or-notification-at-the-top-of-a-page/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10329</post-id>	</item>
		<item>
		<title>Convert image file to text using Google Drive</title>
		<link>https://devarticles.in/convert-image-file-to-text-convert-extract-text-from-image-photo-pdf-file/</link>
					<comments>https://devarticles.in/convert-image-file-to-text-convert-extract-text-from-image-photo-pdf-file/#respond</comments>
		
		<dc:creator><![CDATA[Arvind Kumar]]></dc:creator>
		<pubDate>Sun, 21 Sep 2025 07:06:33 +0000</pubDate>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[google drive]]></category>
		<category><![CDATA[image to text]]></category>
		<category><![CDATA[pdf to text]]></category>
		<category><![CDATA[photo to text]]></category>
		<category><![CDATA[picture to text]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10313</guid>

					<description><![CDATA[<p>There are various online tools or methods to convert image file to text. By converting image into text I mean by extracting all the text that is visible in an image and converting into text string. For example, look at&#8230;</p>
<p><a href="https://devarticles.in/convert-image-file-to-text-convert-extract-text-from-image-photo-pdf-file/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/convert-image-file-to-text-convert-extract-text-from-image-photo-pdf-file/">Convert image file to text using Google Drive</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>There are various online tools or methods to convert image file to text. By converting image into text I mean by extracting all the text that is visible in an image and converting into text string.</p>
<p>For example, look at the picture below. What if you wanted to modify the comprehension test shown in the picture below to have more questions?</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10315" src="https://devarticles.in/wp-content/uploads/2025/09/unseen-comprehension-convert-image-into-text.jpg" alt="" width="474" height="670" srcset="https://devarticles.in/wp-content/uploads/2025/09/unseen-comprehension-convert-image-into-text.jpg 474w, https://devarticles.in/wp-content/uploads/2025/09/unseen-comprehension-convert-image-into-text-212x300.jpg 212w" sizes="auto, (max-width: 474px) 100vw, 474px" /></p>
<p>The answer is to convert image file to text using some online or offline method. The method I use is quite simple and easy for me.</p>
<h2>Using Google Drive to Convert image file to text</h2>
<p>To do it all I needed was to have a Google account, which I guess almost every internet user has.</p>
<p>So there are the steps to convert text from image into text</p>
<ul>
<li>Login into <a href="https://drive.google.com" target="_blank" rel="noopener">https://drive.google.com</a></li>
<li>Upload image file<br />
<img loading="lazy" decoding="async" class="alignnone  wp-image-10316" src="https://devarticles.in/wp-content/uploads/2025/09/google-drive-new-button.jpg" alt="" width="78" height="46" /> &gt; <img loading="lazy" decoding="async" class="alignnone wp-image-10317 size-full" src="https://devarticles.in/wp-content/uploads/2025/09/google-drive-new-upload-button.jpg" alt="Convert image file to text using Google Drive" width="329" height="138" srcset="https://devarticles.in/wp-content/uploads/2025/09/google-drive-new-upload-button.jpg 329w, https://devarticles.in/wp-content/uploads/2025/09/google-drive-new-upload-button-300x126.jpg 300w" sizes="auto, (max-width: 329px) 100vw, 329px" /></li>
<li>Once upload is completed, right click the uploaded image, right click it and navigate through <strong>Open With</strong> &gt; and click <strong>Google Docs.</strong><br />
<img loading="lazy" decoding="async" class="alignnone wp-image-10318" src="https://devarticles.in/wp-content/uploads/2025/09/convert-image-file-into-text-format.jpg" alt="Convert image file to text using Google Drive" width="713" height="421" srcset="https://devarticles.in/wp-content/uploads/2025/09/convert-image-file-into-text-format.jpg 779w, https://devarticles.in/wp-content/uploads/2025/09/convert-image-file-into-text-format-300x177.jpg 300w, https://devarticles.in/wp-content/uploads/2025/09/convert-image-file-into-text-format-768x454.jpg 768w" sizes="auto, (max-width: 713px) 100vw, 713px" /></li>
<li>Based on the file size the doc file will be opened in a new window or tab within a few second. This file has your image at the top and extracted text at the bottom.</li>
</ul>
<p>As per <a href="https://support.google.com/drive/answer/176692" target="_blank" rel="noopener">this google help article,</a> for the best results, use these tips:</p>
<ul>
<li>Format: You can convert PDFs (multipage documents) or photo files (.jpeg, .png and .gif)</li>
<li>File size: The file should be 2 MB or smaller.</li>
<li>Resolution: Text should be at least 10 pixels high.</li>
<li>Orientation: Documents must be right-side up. If your image faces the wrong way, rotate it before you upload it to Google Drive.</li>
<li class="" data-outlined="false">Languages: Google Drive detects the language of the document. <a href="https://support.google.com/drive/answer/176692?hl=en&amp;co=GENIE.Platform%3DDesktop#how" rel="noopener">Learn more about supported languages</a></li>
<li>Font and character set: Use common fonts, such as Arial or Times New Roman.</li>
<li>Image quality: Use sharp images with even lighting and clear contrasts.</li>
</ul>
<p>Limitations of Image to Text conversion, as per <a href="https://support.google.com/drive/answer/176692" target="_blank" rel="noopener">this google help article</a>:</p>
<ul>
<li>The image file is converted, but the format might not transfer:
<ul>
<li>Bold, italics, font size, font type, and line breaks are likely to be retained.</li>
<li>Lists, tables, columns, footnotes, and endnotes are not likely to be detected.</li>
</ul>
</li>
</ul>
<p>Do you know of a better tool to convert image file to text ? If you do please share information about it in the comment section below.</p>
<p>You may be interesting checking out some basic and useful conversion tools created by me!</p>
<p>The post <a href="https://devarticles.in/convert-image-file-to-text-convert-extract-text-from-image-photo-pdf-file/">Convert image file to text using Google Drive</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/convert-image-file-to-text-convert-extract-text-from-image-photo-pdf-file/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10313</post-id>	</item>
		<item>
		<title>Using @ alias in React for cleaner React and TypeScript imports from various paths</title>
		<link>https://devarticles.in/using-alias-in-react-for-cleaner-react-and-typescript-imports-from-various-paths/</link>
					<comments>https://devarticles.in/using-alias-in-react-for-cleaner-react-and-typescript-imports-from-various-paths/#respond</comments>
		
		<dc:creator><![CDATA[Arvind Kumar]]></dc:creator>
		<pubDate>Fri, 19 Sep 2025 06:32:16 +0000</pubDate>
				<category><![CDATA[React]]></category>
		<category><![CDATA[Typescript]]></category>
		<category><![CDATA[@ aliases]]></category>
		<category><![CDATA[import shortcuts in react]]></category>
		<category><![CDATA[react @ alias]]></category>
		<category><![CDATA[react path]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10296</guid>

					<description><![CDATA[<p>React along with TypeScript is a wonderful tool for building scalable, maintainable, modern web applications. React + TypeScript is very popular among developers. In this post we will see the use of Aliases in React+TypeScript+Vite(optional). To follow along with this&#8230;</p>
<p><a href="https://devarticles.in/using-alias-in-react-for-cleaner-react-and-typescript-imports-from-various-paths/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/using-alias-in-react-for-cleaner-react-and-typescript-imports-from-various-paths/">Using @ alias in React for cleaner React and TypeScript imports from various paths</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>React along with TypeScript is a wonderful tool for building scalable, maintainable, modern web applications. React + TypeScript is very popular among developers. In this post we will see the use of Aliases in React+TypeScript+Vite(optional).</p>
<p>To follow along with this tutorial, you’ll need basic knowledge of React, JavaScript and some familiarity with TypeScript. To test it, you should have an existing React App running.</p>
<h2>Why to use @ alias in React?</h2>
<p>In order to import a Button component from same folder or path we will right it as:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import { Button } from './button';</pre>
<p>To import the Button component from a sibling of the parent folder we will write it as:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import { Button } from '../components/button';</pre>
<p>And at some point it will go like:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import { Button } from '../../../../components/button';</pre>
<p>You see how messy the last statement above has become! @ alias is a workaround to this.</p>
<p>As a React project grows in size and complexity, import statements can become tedious. In particular, the default relative path imports can quickly become long and hinder code readability.</p>
<p>So what is the solution to this? Short answer is, to configure one or more path aliases.</p>
<h2>How to use @ alias in react?</h2>
<p>In this article, we will explore how to leverage path aliases to enhance the organization and maintainability of your React and TypeScript projects.</p>
<h2 id="understanding-import-statements-react-typescript-apps">Understanding import statements in React and TypeScript apps</h2>
<p>In React and TypeScript apps, developers use import statements to bring in functionality from other modules or files. This practice ensures we develop software that is reusable and modular.</p>
<p>Although import statements are useful in this way, they can lead to problems when they aren’t used properly. The code snippet below shows a typical example of this problem:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import React from 'react';
import { Button } from '../../../../components/button'; // this is so unpredictable

function SomeComponent() {
  return &lt;Button /&gt;;
};</pre>
<p>As you can see, this code snippet uses relative imports from the current file to import the <code class=" prettyprinted"><span class="typ">Button</span></code> component. However, this import pattern is messy because it’s importing the component from a deeply nested directory.</p>
<p>It may be okay for relatively small projects, but as the project grows, typing and reading long import paths becomes tedious. It may also be slow to load as your app has to search for files, rather than just importing them!</p>
<h2 id="how-path-aliases-can-help-simplify-import-statements">How path aliases can help simplify import statements</h2>
<p>Path aliases let developers define custom shortcuts for import paths, making them cleaner and more intuitive. With path aliases set up, you can have clean and concise imports regardless of the size of the project, as shown in the code snippet below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import React from 'react';
import { Button } from '@components/button'; // clean and concise import :)

function SomeComponent() {
  return &lt;Button /&gt;;
};</pre>
<p>By setting up path aliases in a React and TypeScript app, you can simplify import statements, improve code navigation, and enhance the overall development experience.</p>
<h2 id="configuring-path-aliases-tsconfig-json-file">Configuring path aliases in the <code class=" prettyprinted"><span class="pln">tsconfig</span><span class="pun">.</span><span class="pln">json</span></code> OR <code>tsconfig.app.json</code> file</h2>
<p>You can configure path aliases easily in your project’s <code class=" prettyprinted"><span class="pln">tsconfig</span><span class="pun">.</span><span class="pln">json</span></code> OR <code>tsconfig.app.json</code> file if it exists. <code>tsconfig.app.json</code> takes a precedence. These files are usually found at the root of a TypeScript project.</p>
<p>To configure your path aliases in this file, simply add a <code class=" prettyprinted"><span class="pln">paths</span></code> property in <a href="https://blog.logrocket.com/exploring-advanced-compiler-options-typescript/">the <code class=" prettyprinted"><span class="pln">compilerOptions</span></code> object</a>. Then, you can map path alias names to file paths as shown in the code snippet below:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}</pre>
<p>The above code tells the TypeScript compiler to resolve imports from the <code class=" prettyprinted"><span class="pun">@</span><span class="com">/*</span></code> alias to the <code class=" prettyprinted"><span class="pun">.</span><span class="str">/src/</span><span class="pun">*</span></code> directory. Once you set up the path alias, you can use it in your import statements.</p>
<p>For example, you can import a <code class=" prettyprinted"><span class="typ">Button</span></code> component in the <code class=" prettyprinted"><span class="pln">src</span><span class="pun">/</span><span class="pln">components</span></code> directory directly from anywhere in the project like this:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import { Button } from "@/components/Button"; 

function App() { 
  return ( &lt;Button&gt;Click Me&lt;/Button&gt; )
}</pre>
<p>Without a path alias set up, importing the <code class=" prettyprinted"><span class="typ">Button</span></code> component from another file — for example, <code class=" prettyprinted"><span class="pln">src</span><span class="pun">/</span><span class="pln">pages</span><span class="pun">/</span><span class="pln">dashboard</span><span class="pun">/</span><span class="pln">profile</span><span class="pun">/</span><span class="pln">settings</span><span class="pun">/</span><span class="pln">index</span><span class="pun">.</span><span class="pln">tsx</span></code> — would look something like this:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import { Button } from '../../../../components/Button';

function Settings() {
  return (
    &lt;Button&gt;Click Me&lt;/Button&gt;
  )
}</pre>
<p>You can take this a step further and add more path aliases, which can be beneficial for large projects that store critical parts of the app in well-defined directories. In the <code class=" prettyprinted"><span class="pln">tsconfig</span><span class="pun">.app.</span><span class="pln">json</span></code> file, update the <code class=" prettyprinted"><span class="pln">paths</span></code> field as shown in the following code snippet:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">{
  "compilerOptions": {
    "baseUrl" : "./src",
    "paths": {
      "@components/*": ["./components/*"],
      "@ui/*": ["./components/common/ui/*"],
      "@pages/*": ["./pages/*"],
      "@hooks/*": ["./hooks/*"],
      "@api/*": ["./api/*"],
      "@utils/*": ["./utils/*"],
    }
  }
}</pre>
<p>The <code class=" prettyprinted"><span class="pln">baseUrl</span></code> field in the code snippet above is used to make the path aliases shorter to write.</p>
<h2>Using Vite? Edit the vite.config.ts</h2>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="classic">import path from 'path';

...

export default defineConfig({
  ...
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
})</pre>
<p>You can add more alias as you did in the <code class=" prettyprinted"><span class="pln">tsconfig</span><span class="pun">.app.</span><span class="pln">json</span></code> file above.</p>
<p>There is a plugin which can compile paths defined in the <code>tsconfig.json</code> or <code class=" prettyprinted"><span class="pln">tsconfig</span><span class="pun">.app.</span><span class="pln">json</span></code> and insert them into the <code>defineConfig</code> module of vite. Install this module if you want to save yourself from updating two files each time you add new alias to <code>vite</code> or <code>tsconfig</code> configuration file.</p>
<h3>Install vite-tsconfig-paths plugin (optional)</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">npm install vite-tsconfig-paths</pre>
<h3>Update vite.config.ts</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">import tsconfigPaths from 'vite-tsconfig-paths'</pre>
<p>And add to plugins</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">export default defineConfig({
  plugins: [
    react(),
    ....other plugins
    tsconfigPaths()
  ]
})</pre>
<p>After adding and setting this plugin next time you have to add new alias in the <code>tsconfig.json</code> or <code>tsconfig.app.json</code> file only.</p>
<p>The post <a href="https://devarticles.in/using-alias-in-react-for-cleaner-react-and-typescript-imports-from-various-paths/">Using @ alias in React for cleaner React and TypeScript imports from various paths</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/using-alias-in-react-for-cleaner-react-and-typescript-imports-from-various-paths/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10296</post-id>	</item>
		<item>
		<title>Deploying Next.js Application with Nginx on Ubuntu – 2025</title>
		<link>https://devarticles.in/deploying-next-js-application-nginx-ubuntu-24-2025/</link>
					<comments>https://devarticles.in/deploying-next-js-application-nginx-ubuntu-24-2025/#respond</comments>
		
		<dc:creator><![CDATA[Arvind Kumar]]></dc:creator>
		<pubDate>Sun, 24 Aug 2025 09:24:44 +0000</pubDate>
				<category><![CDATA[Next.Js]]></category>
		<category><![CDATA[React]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[nextjs]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[reactjs]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10109</guid>

					<description><![CDATA[<p>Next.js is a popular React framework which enables developers to build user-friendly web applications and websites. It come with inbuilt file/folder name based routing to jetpack developers into the code part directly.  Next.js simplifies the process of creating both static&#8230;</p>
<p><a href="https://devarticles.in/deploying-next-js-application-nginx-ubuntu-24-2025/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/deploying-next-js-application-nginx-ubuntu-24-2025/">Deploying Next.js Application with Nginx on Ubuntu &#8211; 2025</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a title="Next.js" href="https://nextjs.org/" target="_blank" rel="noopener">Next.js</a> is a popular React framework which enables developers to build user-friendly web applications and websites. It come with inbuilt file/folder name based routing to jetpack developers into the code part directly.  Next.js simplifies the process of creating both static and dynamic web pages, offering built-in features like server-side rendering (SSR) and static site generation (SSG). These features enhance performance and SEO by allowing pages to be pre-rendered on the server. Next.js also supports API routes, enabling developers to build full-stack applications within a single framework.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-10275 size-full" src="https://devarticles.in/wp-content/uploads/2025/08/how-to-deploy-next-js-on-ubuntu.png" alt="Deploying Next.js Application with Nginx on Ubuntu" width="824" height="460" /></p>
<p>Deploying Next.js application on an Ubuntu VPS with Nginx as the reverse proxy is a reliable and efficient way to serve your web application. In this tutorial, we’ll walk through the steps to set up and deploy Next.js application on an Ubuntu server using Nginx.</p>
<h4>Prerequisites</h4>
<p>Before you begin deploying Next.js application, make sure you have the following:</p>
<ul>
<li>A server running Ubuntu 24.04</li>
<li>Basic knowledge of the Linux command line.</li>
<li>A root user access or normal user with sudo rights.</li>
</ul>
<h3>Deploying Next.js Application with Nginx on Ubuntu</h3>
<p>Deploying Next.js Application on Ubuntu 24 with Nginx involves some simple server tasks and to install some required software and tools.</p>
<h4>Step 1: Update and Secure Your Server</h4>
<p>Before deploying Next.js application, it’s essential to update your server packages and secure it.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo apt update &amp;&amp; sudo apt upgrade -y</pre>
<h4>Step 2: Install Node.js and npm</h4>
<p>For latest version, visit the Node.js <a href="https://nodejs.org/en/download">official documentation page</a>.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic"># installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

# download and install Node.js (you may need to restart the terminal)
nvm install 22</pre>
<p>Verify installation</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic"># verifies the right Node.js version is in the environment
node -v # should print `v22.17.0`

# verifies the right npm version is in the environment
npm -v # should print `10.9.2`</pre>
<h4>Step 3: Install and Configure Nginx</h4>
<p>Install Nginx:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo apt install nginx -y</pre>
<p>Create a new Nginx configuration file for your application:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo nano /etc/nginx/sites-available/your-nextjs-app</pre>
<p>Add the following configuration:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">server {
    listen 80;
    server_name your_domain_or_ip;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}</pre>
<p><strong>Replace</strong> <code>your_domain_or_ip</code> with your domain name or server IP address. Save and close the file.</p>
<p>Create a symbolic link to enable this configuration:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo ln -s /etc/nginx/sites-available/your-nextjs-app /etc/nginx/sites-enabled/</pre>
<p>Test the Nginx configuration to ensure there are no errors:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo nginx -t</pre>
<p>If the test is successful, restart Nginx:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo systemctl restart nginx</pre>
<h4>Step 4: Secure Your Application with SSL</h4>
<p>It&#8217;s highly recommended to secure your application with SSL. You can use Certbot to obtain a free SSL certificate from Let&#8217;s Encrypt.</p>
<p>First, install Certbot:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo apt install certbot python3-certbot-nginx -y</pre>
<p>Then, run Certbot to obtain and configure the SSL certificate:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">sudo certbot --nginx -d your_domain</pre>
<p>Certbot will automatically configure SSL for your Nginx site.</p>
<h4>Step 5: Install Next.js</h4>
<p>You can install new Next.js app, or clone an existing app from a git repository to a new folder or just copy an existing app from a <a href="https://devarticles.in/how-to-show-the-full-url-of-a-git-repository-using-git-command/">git repository</a> to current folder. I will put an example for each app below.</p>
<h5>Method 1: Create new Next.js app</h5>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">npx create-next-app@latest</pre>
<p>And follow instructions shown on the screen. For example, I installed a test app for this article, as shown below.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">Need to install the following packages:
create-next-app@15.3.5
Ok to proceed? (y) y

<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What is your project named? … myapp
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Would you like to use TypeScript? … No / Yes
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Would you like to use ESLint? … No / Yes
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Would you like to use Tailwind CSS? … No / Yes
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Would you like your code inside a `src/` directory? … No / Yes
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Would you like to use App Router? (recommended) … No / Yes
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Would you like to use Turbopack for `next dev`? … No / Yes
<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Would you like to customize the import alias (`@/*` by default)? … No / Yes</pre>
<p>When installed <code>cd</code> into <code>myapp</code>, or whatever name you chose, folder, and skip to the next step.</p>
<h5>Method 2: Clone from git repository</h5>
<p>Clone existing app from a git repository you have url for.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">git clone https://bitbucket.org/inimisttech/online-tools.git myapp
cd myapp</pre>
<p><code>cd</code> into <code>myapp</code>, or whatever name you chose, folder, and skip to the next step.</p>
<h5>Method 3: Use existing git repository in current folder</h5>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">cd /var/www/html
mkdir myapp &amp;&amp; cd myapp</pre>
<p>and setup git inside the myapp folder</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">git init
git remote add "origin" https://bitbucket.org/inimisttech/online-tools.git
git fetch origin master:master
git checkout master</pre>
<p>Past this step you should be able to complete your Next.js app setup and deployment.</p>
<h3>Deploying Next.js Application &#8211; Final Step</h3>
<h4>Step 6: Build the app and run the app</h4>
<p>Since we have all the tools and file ready by now, we can install the necessary node modules mentioned in our package.json file.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">npm install</pre>
<p>And finally build</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">npm run build</pre>
<p>and run</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">npm run start</pre>
<p>Alternately you could use a server manager such as <a href="https://pm2.keymetrics.io/" target="_blank" rel="noopener"><strong>pm2</strong></a> to run your app.</p>
<p>I would install pm2 globally</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">npm i pm2 -g</pre>
<p>And run app via it</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">pm2 start npm --name "inimisttools.com app" -- run start</pre>
<p>I have created a very useful <a href="https://inimisttools.com">inimisttools.com</a> app with various &#8220;daily use tools&#8221; for deploying Next.js Application. It led me to blog these steps involved to build and Deploy Next.js Application with Nginx on Ubuntu , for my own reference later on as well.</p>
<p>The post <a href="https://devarticles.in/deploying-next-js-application-nginx-ubuntu-24-2025/">Deploying Next.js Application with Nginx on Ubuntu &#8211; 2025</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/deploying-next-js-application-nginx-ubuntu-24-2025/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10109</post-id>	</item>
		<item>
		<title>PHP Magic Methods</title>
		<link>https://devarticles.in/php-magic-methods/</link>
					<comments>https://devarticles.in/php-magic-methods/#respond</comments>
		
		<dc:creator><![CDATA[Sharleen Kaur]]></dc:creator>
		<pubDate>Fri, 22 Aug 2025 06:24:19 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10266</guid>

					<description><![CDATA[<p>PHP Magic methods are special methods that begin with double underscores (__) and are automatically triggered by specific actions within your code. These methods allow you to define powerful and dynamic behaviors in your classes. In this article, we’ll cover:&#8230;</p>
<p><a href="https://devarticles.in/php-magic-methods/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/php-magic-methods/">PHP Magic Methods</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>PHP Magic methods are special methods that begin with double underscores (__) and are automatically triggered by specific actions within your code. These methods allow you to define powerful and dynamic behaviors in your classes. In this article, we’ll cover:</p>
<p>1) What magic methods are<br />
2) The most commonly used magic methods<br />
3) Code examples for each<br />
4) Best practices</p>
<h2>What Are PHP Magic Methods?</h2>
<p>Magic methods are predefined methods that PHP calls automatically when certain events occur. They are often used to control property access, method calls, and object behavior in a flexible and elegant way.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10267" src="https://devarticles.in/wp-content/uploads/2025/08/php_megic_methods.png" alt="" width="800" height="800" srcset="https://devarticles.in/wp-content/uploads/2025/08/php_megic_methods.png 800w, https://devarticles.in/wp-content/uploads/2025/08/php_megic_methods-300x300.png 300w, https://devarticles.in/wp-content/uploads/2025/08/php_megic_methods-150x150.png 150w, https://devarticles.in/wp-content/uploads/2025/08/php_megic_methods-768x768.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></p>
<h2>Common Magic Methods (with Examples)</h2>
<h3>1. __construct() – Constructor</h3>
<p>Called automatically when a new object is created.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class User {
    public function __construct($name) {
        echo "User $name created!";
    }
}

$user = new User("Alice");
// Output: User Alice created!

?&gt;</pre>
<h3>2. __destruct() – Destructor</h3>
<p>Called when an object is destroyed (end of script or unset).</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class Logger {
    public function __destruct() {
        echo "Cleaning up...";
    }
}

$log = new Logger();
// Output on script end: Cleaning up...
?&gt;</pre>
<h3>3. __get() – Accessing Inaccessible/Nonexistent Properties</h3>
<p>&nbsp;</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class Product {
    private $data = ['name' =&gt; 'Laptop'];

    public function __get($property) {
        return $this-&gt;data[$property] ?? "Property not found!";
    }
}

$p = new Product();
echo $p-&gt;name;  // Output: Laptop
echo $p-&gt;price; // Output: Property not found!

?&gt;
</pre>
<h3>4. __set() – Setting Inaccessible/Nonexistent Properties</h3>
<p>&nbsp;</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class Product {
    private $data = [];

    public function __set($key, $value) {
        $this-&gt;data[$key] = $value;
    }

    public function __get($key) {
        return $this-&gt;data[$key] ?? null;
    }
}

$p = new Product();
$p-&gt;name = "Smartphone";
echo $p-&gt;name; // Output: Smartphone

?&gt;</pre>
<h3>5. __isset() and __unset()</h3>
<p>Used when calling isset() or unset() on inaccessible properties.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class User {
    private $data = ['email' =&gt; 'test@example.com'];

    public function __isset($key) {
        return isset($this-&gt;data[$key]);
    }

    public function __unset($key) {
        unset($this-&gt;data[$key]);
    }
}

$u = new User();
var_dump(isset($u-&gt;email)); // true
unset($u-&gt;email);
var_dump(isset($u-&gt;email)); // false

?&gt;</pre>
<h3>6. __call() – Handling Undefined Method Calls (Object Context)</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class Magic {
    public function __call($name, $arguments) {
        return "Method '$name' does not exist. Arguments: " . implode(", ", $arguments);
    }
}

$obj = new Magic();
echo $obj-&gt;doSomething("arg1", "arg2");
// Output: Method 'doSomething' does not exist. Arguments: arg1, arg2

?&gt;</pre>
<h3>7. __callStatic() – Undefined Static Method Calls</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class StaticMagic {
    public static function __callStatic($name, $args) {
        return "Static method '$name' was called with arguments: " . implode(", ", $args);
    }
}

echo StaticMagic::unknown("x", "y");
// Output: Static method 'unknown' was called with arguments: x, y

?&gt;</pre>
<h3>8. __toString() – When Object is Treated Like a String</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class Book {
    public function __toString() {
        return "Book object";
    }
}

$b = new Book();
echo $b; // Output: Book object

?&gt;</pre>
<h3>9. __invoke() – When Object is Called Like a Function</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class Greeter {
    public function __invoke($name) {
        return "Hello, $name!";
    }
}

$greet = new Greeter();
echo $greet("John"); // Output: Hello, John!

?&gt;
</pre>
<h3>10. __clone() – When an Object is Cloned</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
class Test {
    public function __clone() {
        echo "Object cloned!";
    }
}

$t1 = new Test();
$t2 = clone $t1;
// Output: Object cloned!
?&gt;</pre>
<h2>Best Practices for Using Magic Methods</h2>
<p>1) Avoid overusing magic methods—they can make code harder to read/debug.<br />
2) Use them only when they provide real flexibility (e.g., dynamic properties or lazy loading).<br />
3) Always document them well for maintainability.</p>
<h2>
Final Thoughts:</h2>
<p>Magic methods in PHP give you the power to create flexible, dynamic, and clean OOP code. Whether you’re building custom property handlers, dynamic method calls, or string representations of objects, these methods can help—but use them wisely.</p>
<p>Read Also:<br />
<a href="https://devarticles.in/php-and-json-encode-decode-and-handle-json-data/">PHP and JSON: Encode, Decode, and Handle JSON Data</a></p>
<p><a href="https://devarticles.in/how-to-create-a-simple-form-and-handle-form-data-in-php/">How to Create a Simple Form and Handle Form Data in PHP</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://devarticles.in/php-magic-methods/">PHP Magic Methods</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/php-magic-methods/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10266</post-id>	</item>
		<item>
		<title>PHP and JSON: Encode, Decode, and Handle JSON Data</title>
		<link>https://devarticles.in/php-and-json-encode-decode-and-handle-json-data/</link>
					<comments>https://devarticles.in/php-and-json-encode-decode-and-handle-json-data/#respond</comments>
		
		<dc:creator><![CDATA[Kuldeep Rathore]]></dc:creator>
		<pubDate>Thu, 21 Aug 2025 07:20:15 +0000</pubDate>
				<category><![CDATA[Miscelleneous]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10256</guid>

					<description><![CDATA[<p>JSON (JavaScript Object Notation) is a lightweight data format that’s perfect for exchanging information between a client and a server—and it plays especially well with PHP. Whether you’re working on an API, handling AJAX requests, or storing structured data, PHP&#8230;</p>
<p><a href="https://devarticles.in/php-and-json-encode-decode-and-handle-json-data/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/php-and-json-encode-decode-and-handle-json-data/">PHP and JSON: Encode, Decode, and Handle JSON Data</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>JSON (JavaScript Object Notation) is a lightweight data format that’s perfect for exchanging information between a client and a server—and it plays especially well with PHP. Whether you’re working on an API, handling AJAX requests, or storing structured data, PHP provides easy functions to encode and decode JSON.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10258" src="https://devarticles.in/wp-content/uploads/2025/08/php-and-json-.png" alt="" width="800" height="533" srcset="https://devarticles.in/wp-content/uploads/2025/08/php-and-json-.png 800w, https://devarticles.in/wp-content/uploads/2025/08/php-and-json--300x200.png 300w, https://devarticles.in/wp-content/uploads/2025/08/php-and-json--768x512.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></p>
<h2>Encode PHP Data to JSON</h2>
<p>To convert PHP arrays or objects into JSON strings, use the json_encode() function.</p>
<h3>Example:</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
$user = [
  "name" =&gt; "Alice",
  "age" =&gt; 25,
  "email" =&gt; "alice@example.com"
];

$json = json_encode($user);
echo $json;
// Output: {"name":"Alice","age":25,"email":"alice@example.com"}
?&gt;</pre>
<p>You can also use JSON_PRETTY_PRINT for better readability:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
You can also use JSON_PRETTY_PRINT for better readability:
?&gt;</pre>
<h2>Decode JSON to PHP</h2>
<p>To convert a JSON string into a PHP variable, use json_decode().</p>
<h3>Example (As Object):</h3>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
$json = '{"name":"Bob","age":30,"email":"bob@example.com"}';

$data = json_decode($json);
echo $data-&gt;name; // Output: Bob
?&gt;
</pre>
<p>Example (As Array):<br />
Pass true as the second parameter to get an associative array:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php

$data = json_decode($json, true);
echo $data['email']; // Output: bob@example.com

?&gt;</pre>
<p>Handling JSON in API Requests<br />
When working with APIs or JavaScript (AJAX), you’ll often receive raw JSON. Here&#8217;s how you handle that in PHP:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
// Read raw POST input
$input = file_get_contents("php://input");

// Decode JSON to array
$data = json_decode($input, true);

echo "Name received: " . $data['name'];
?&gt;</pre>
<h2>Common Use Cases</h2>
<p>1) Send JSON to JavaScript: echo json_encode($data);<br />
2) Receive JSON via fetch() or Axios from the frontend<br />
3) Store structured settings or logs in JSON format<br />
4) Build REST APIs that return JSON responses</p>
<h2>Error Handling</h2>
<p>Always check for decoding errors with json_last_error():</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
if (json_last_error() !== JSON_ERROR_NONE) {
    echo "JSON Error: " . json_last_error_msg();
}
?&gt;</pre>
<h2>Summary</h2>
<p>1) Use json_encode() to send PHP data as JSON.<br />
2) Use json_decode() to parse JSON into PHP arrays or objects.<br />
3) Perfect for APIs, AJAX, and frontend-backend communication.<br />
4) Always validate and sanitize incoming data.</p>
<p>JSON is simple yet powerful, and with PHP, it takes just a few lines to integrate it into your project. Whether you’re building modern web apps or connecting APIs, knowing how to handle JSON is a must.</p>
<p>Read Also:<br />
<a href="https://devarticles.in/how-to-create-a-simple-form-and-handle-form-data-in-php/">How to Create a Simple Form and Handle Form Data in PHP</a></p>
<p><a href="https://devarticles.in/how-to-connect-php-with-mysql-database/">How to Connect PHP with MySQL Database</a></p>
<p>Also Visit:<br />
<a href="https://inimisttech.com/">https://inimisttech.com/</a></p>
<p>The post <a href="https://devarticles.in/php-and-json-encode-decode-and-handle-json-data/">PHP and JSON: Encode, Decode, and Handle JSON Data</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/php-and-json-encode-decode-and-handle-json-data/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10256</post-id>	</item>
		<item>
		<title>How to Create a Simple Form and Handle Form Data in PHP</title>
		<link>https://devarticles.in/how-to-create-a-simple-form-and-handle-form-data-in-php/</link>
					<comments>https://devarticles.in/how-to-create-a-simple-form-and-handle-form-data-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Sharleen Kaur]]></dc:creator>
		<pubDate>Wed, 06 Aug 2025 06:09:42 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10247</guid>

					<description><![CDATA[<p>PHP helps to create a simple form and handle form data. PHP allows you to collect and process form data submitted by users through HTML forms. Follow the steps below to create and handle a simple form in PHP 1.Create&#8230;</p>
<p><a href="https://devarticles.in/how-to-create-a-simple-form-and-handle-form-data-in-php/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/how-to-create-a-simple-form-and-handle-form-data-in-php/">How to Create a Simple Form and Handle Form Data in PHP</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>PHP helps to create a simple form and handle form data. PHP allows you to collect and process form data submitted by users through HTML forms.</p>
<p>Follow the steps below to create and handle a simple form in PHP</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10248" src="https://devarticles.in/wp-content/uploads/2025/08/How-to-Create-a-Simple-Form-and-Handle-Form-Data-in-PHP.png" alt="" width="800" height="533" srcset="https://devarticles.in/wp-content/uploads/2025/08/How-to-Create-a-Simple-Form-and-Handle-Form-Data-in-PHP.png 800w, https://devarticles.in/wp-content/uploads/2025/08/How-to-Create-a-Simple-Form-and-Handle-Form-Data-in-PHP-300x200.png 300w, https://devarticles.in/wp-content/uploads/2025/08/How-to-Create-a-Simple-Form-and-Handle-Form-Data-in-PHP-768x512.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></p>
<h2>1.Create a Simple HTML Form</h2>
<p>First, create a form that asks for user input, like a name.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;form method="POST" action="process.php"&gt;
&lt;label for="name"&gt;Enter your name:&lt;/label&gt;
  &lt;input type="text" id="name" name="name"&gt;
  &lt;button type="submit"&gt;Submit&lt;/button&gt;
&lt;/form&gt;
</pre>
<ul>
<li>method=&#8221;POST&#8221; means data will be sent securely.</li>
<li>action=&#8221;process.php&#8221; means form data will be handled in process.php file.</li>
</ul>
<h2>2. Handle Form Data in PHP (process.php)</h2>
<p>Now in process.php, get the data using $_POST.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
     // Get the value from input field
    $name = $_POST['name'];
// Display the name
    echo "Hello, " . htmlspecialchars($name);
}
?&gt;
</pre>
<p>&nbsp;</p>
<ul>
<li>$_POST[&#8216;name&#8217;] gets the input data.</li>
<li>htmlspecialchars() is used for security</li>
</ul>
<p>&nbsp;</p>
<h2>3. Using $_GET Instead of $_POST</h2>
<p>If you use method=&#8221;GET&#8221; in the form, you will collect data like this:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
// Get the value if form submitted with GET
$name = $_GET['name'];
echo "Hello, " . htmlspecialchars($name);
?&gt;
</pre>
<p>&nbsp;</p>
<ul>
<li>GET method shows data in URL, while POST does not.</li>
</ul>
<p>&nbsp;</p>
<h1>Summary</h1>
<p>Create a simple form and handle form data in PHP is simple. You design the form using HTML and then capture user input in PHP using $_POST or $_GET.</p>
<p>Read Also :-<br />
<a href="https://devarticles.in/how-to-connect-php-with-mysql-database/">How to Connect PHP with MySQL Database</a></p>
<p><a href="https://devarticles.in/the-role-of-wpdb-for-custom-queries-in-wordpress/">The Role of $wpdb for Custom Queries in WordPress</a></p>
<p>Also visit:<br />
<a href="http://www.inimisttech.com/">http://www.inimisttech.com/</a></p>
<p>The post <a href="https://devarticles.in/how-to-create-a-simple-form-and-handle-form-data-in-php/">How to Create a Simple Form and Handle Form Data in PHP</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/how-to-create-a-simple-form-and-handle-form-data-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10247</post-id>	</item>
		<item>
		<title>How to Connect PHP with MySQL Database</title>
		<link>https://devarticles.in/how-to-connect-php-with-mysql-database/</link>
					<comments>https://devarticles.in/how-to-connect-php-with-mysql-database/#respond</comments>
		
		<dc:creator><![CDATA[Sharleen Kaur]]></dc:creator>
		<pubDate>Mon, 04 Aug 2025 06:08:54 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://devarticles.in/?p=10240</guid>

					<description><![CDATA[<p>Connecting PHP with a MySQL database allows you to store, retrieve, and manage data easily for your web application. Follow the steps below to connect PHP with MySQL: 1.Create a database First, create a database using PHPMyAdmin or the MySQL&#8230;</p>
<p><a href="https://devarticles.in/how-to-connect-php-with-mysql-database/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a href="https://devarticles.in/how-to-connect-php-with-mysql-database/">How to Connect PHP with MySQL Database</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Connecting PHP with a MySQL database allows you to store, retrieve, and manage data easily for your web application.</p>
<h1>Follow the steps below to connect PHP with MySQL:</h1>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10241" src="https://devarticles.in/wp-content/uploads/2025/08/How-to-Connect-PHP-with-MySQL-Database.png" alt="" width="800" height="533" srcset="https://devarticles.in/wp-content/uploads/2025/08/How-to-Connect-PHP-with-MySQL-Database.png 800w, https://devarticles.in/wp-content/uploads/2025/08/How-to-Connect-PHP-with-MySQL-Database-300x200.png 300w, https://devarticles.in/wp-content/uploads/2025/08/How-to-Connect-PHP-with-MySQL-Database-768x512.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></p>
<h2>1.Create a database</h2>
<p>First, create a database using PHPMyAdmin or the MySQL command line.</p>
<p>Example:</p>
<p>Database name: testdb</p>
<h2>2. Connect to Database</h2>
<p>To connect to a database using procedural style, use mysqli_connect().</p>
<p>&nbsp;</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
$servername = "localhost";
$username = "root";
$password = "";
$database = "testdb";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?&gt;
</pre>
<h2>3. Connect to Database (Object-Oriented Style)</h2>
<p>You can also connect using object-oriented style with new mysqli().</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
$servername = "localhost";
$username = "root";
$password = "";
$database = "testdb";
// Create connection
$conn = new mysqli($servername, $username, $password, $database);
// Check connection
if ($conn-&gt;connect_error) {
    die("Connection failed: " . $conn-&gt;connect_error);
}
echo "Connected successfully";
?&gt;
</pre>
<h2>4. Close the Database Connection</h2>
<p>To close the connection use</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
$conn-&gt;close();
?&gt;
</pre>
<h2>Summary</h2>
<p>PHP allows you to connect to MySQL easily using either procedural or object-oriented methods. Always check the connection and close it after your work to save server resources.</p>
<p>The post <a href="https://devarticles.in/how-to-connect-php-with-mysql-database/">How to Connect PHP with MySQL Database</a> appeared first on <a href="https://devarticles.in">InimistTech Blogs</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://devarticles.in/how-to-connect-php-with-mysql-database/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">10240</post-id>	</item>
	</channel>
</rss>