<?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: Moataz khaled</title>
    <description>The latest articles on DEV Community by Moataz khaled (@moatazkhaled93).</description>
    <link>https://dev.to/moatazkhaled93</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%2F539657%2Ffa1aa6f1-0698-4be0-9477-fcf84a0b3a43.jpg</url>
      <title>DEV Community: Moataz khaled</title>
      <link>https://dev.to/moatazkhaled93</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moatazkhaled93"/>
    <language>en</language>
    <item>
      <title>Elevating Laravel Development with the Singleton Design Pattern</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Sat, 03 Aug 2024 00:32:15 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/elevating-laravel-development-with-the-singleton-design-pattern-p1c</link>
      <guid>https://dev.to/moatazkhaled93/elevating-laravel-development-with-the-singleton-design-pattern-p1c</guid>
      <description>&lt;p&gt;As a Team Lead at Lamasatech, I constantly seek ways to enhance our software architecture and development processes. One design pattern that has proven indispensable in achieving robust and maintainable code is the Singleton Design Pattern.&lt;br&gt;
Understanding the Singleton Design Pattern&lt;/p&gt;

&lt;p&gt;The Singleton Design Pattern ensures that a class has only one instance and provides a global point of access to that instance. This pattern is particularly beneficial in scenarios where a single point of control is needed, such as in managing shared resources.&lt;br&gt;
&lt;strong&gt;Why Implement Singleton in Laravel?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Service Container: Laravel’s service container allows for managing class dependencies efficiently. By binding a class as a singleton, Laravel ensures a single instance is used throughout the application, promoting consistency and resource efficiency.&lt;br&gt;
Configuration Management: Centralizing configuration settings through a singleton ensures that all parts of the application access the same configuration instance, maintaining uniformity.&lt;br&gt;
Logging: Implementing a singleton logging service ensures that logs are handled by a single, consistent instance, simplifying log management.&lt;br&gt;
Cache Management: A singleton cache manager ensures a unified and consistent caching mechanism across the application.&lt;/p&gt;

&lt;p&gt;Implementing Singleton in Laravel&lt;/p&gt;

&lt;p&gt;Laravel simplifies the implementation of singletons through its service container. Here’s how to bind a class as a singleton in Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this-&amp;gt;app-&amp;gt;singleton('SomeService', function ($app) {
            return new \App\Services\SomeService();
        });
    }
}

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

&lt;/div&gt;



&lt;p&gt;In this setup, the SomeService class is instantiated only once, and the same instance is used for subsequent calls.&lt;br&gt;
Practical Example: Logging Service&lt;/p&gt;

&lt;p&gt;Consider a logging service you want to use throughout your Laravel application. By binding it as a singleton, you ensure all parts of your application use the same logging instance, thereby simplifying log management:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace App\Services;

class LoggingService
{
    public function log($message)
    {
        // Log message to a file or database
    }
}

// In AppServiceProvider
$this-&amp;gt;app-&amp;gt;singleton('LoggingService', function ($app) {
    return new \App\Services\LoggingService();
});

// Usage in a controller
public function index(\App\Services\LoggingService $loggingService)
{
    $loggingService-&amp;gt;log('This is a log message.');
}

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

&lt;/div&gt;



&lt;p&gt;By leveraging the Singleton Design Pattern in Laravel, we can create more maintainable, efficient, and scalable applications. Whether you're a budding developer or a seasoned architect, mastering design patterns like Singleton is crucial for advancing your coding expertise.&lt;/p&gt;

&lt;p&gt;How do you utilize the Singleton Design Pattern in your Laravel projects? Share your experiences and insights in the comments below!&lt;/p&gt;

&lt;h1&gt;
  
  
  Laravel #SoftwareDevelopment #DesignPatterns #Singleton #CodingTips #PHP #SoftwareEngineering #TechLeadership #CleanCode
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>TERMINAL COMMAND LINE ORDERS</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Wed, 21 Jun 2023 19:19:19 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/terminal-command-line-orders-3ie</link>
      <guid>https://dev.to/moatazkhaled93/terminal-command-line-orders-3ie</guid>
      <description>&lt;p&gt;✨Let's explore some background on the terminal🏃‍♂️🏃‍♂️🏃‍♂️....&lt;br&gt;
&lt;strong&gt;What is the terminal?&lt;/strong&gt;&lt;br&gt;
Terminal is an application that lets you interact with your computer.You usually give instructions to your computer through clicking around in applications or typing keys to make&lt;br&gt;
things happen.&lt;br&gt;
Terminal lets you do many of the same things; it’s just&lt;br&gt;
more direct. You can give clear, structured orders to your computer using the terminal.&lt;br&gt;
You just have to be patient and willing to try them!&lt;br&gt;
&lt;strong&gt;"Where am I?" in my computer&lt;/strong&gt;&lt;br&gt;
When you first launch Terminal, you'll likely have an empty window with not much going on. My Terminal window looks like this, but yours is probably a different color or set of text on the left (which is fine!)&lt;br&gt;
I see a simple dollar sign and a blinking cursor, but you might see the name of your computer too or other symbols:&lt;br&gt;
💁💁💁..&lt;br&gt;
*&lt;em&gt;Run this command *&lt;/em&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

pwd


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Finding destinations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In your computer, you can go pretty much anywhere you want. First, though, you must know the destinations available to you.&lt;br&gt;
On the command line, type the following command (ls , which is short for list), and press the Enter key on your keyboard.&lt;br&gt;
*&lt;em&gt;Run this command *&lt;/em&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ls


&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%2Fuploads%2Farticles%2F44r7kp2iyhmsmu92y3wm.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%2Fuploads%2Farticles%2F44r7kp2iyhmsmu92y3wm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Going to destinations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that you've revealed possible directories (folders) available to you, you can move around them using a different command:cd which is short for "change directory," plus the name of the folder where you want to move.&lt;br&gt;
For example, let's say I want to change locations in my system and move into the "Music" folder. This was listed as one of the options in the output from our ls command. I'd type:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

    cd Music


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

&lt;/div&gt;

&lt;p&gt;Here's what my Terminal looks like after running cd Music:&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%2Fuploads%2Farticles%2Fs24w2rmfa7mpojjgyyhu.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%2Fuploads%2Farticles%2Fs24w2rmfa7mpojjgyyhu.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create directory&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's now time to create a folder within your system.&lt;br&gt;
Yes, you could just do this via Finder or whatever tool you use to browse and create files now. However, there are advantages to doing this via the terminal, especially if you want to get more into programming!&lt;br&gt;
How does one go about creating a folder in Terminal? Time for a new command!&lt;br&gt;
Use the command  mkdir  to create a directory.  mkdir  is short for "make directory." Specify the name of the directory (folder) you want to create just after it. If I wanted to create a folder called  new-folder , I would run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

    mkdir new-folder


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Move File&lt;/strong&gt;&lt;br&gt;
 if you want to move file in the same path or another directory&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

mv fileName  /temp/fileName


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;copy File&lt;/strong&gt;&lt;br&gt;
 if you want to cope file in the same path or another directory&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

cp fileName  newfileName


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Remove File&lt;/strong&gt;&lt;br&gt;
 if you want to remove file in the same path or another directory&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

rm fileName


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Remove folders&lt;/strong&gt;&lt;br&gt;
 if you want to remove folders in the same path or another directory&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

rmdir folderName


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

&lt;/div&gt;

</description>
      <category>terminal</category>
      <category>ubuntu</category>
      <category>shell</category>
      <category>bash</category>
    </item>
    <item>
      <title>I have a question!</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Thu, 19 May 2022 00:13:34 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/i-have-a-question-3c7g</link>
      <guid>https://dev.to/moatazkhaled93/i-have-a-question-3c7g</guid>
      <description>&lt;p&gt;I have a question! design patterns and SOLID principles are the perfect way to use enhancement performance and clean code &lt;br&gt;
when searching for design patterns I found this question &lt;br&gt;
Why Are Singletons Bad?&lt;br&gt;
when I read the article I found him opinion's true&lt;br&gt;
so I want to open a discussion on this point &lt;br&gt;
design patterns and SOLID principles are the perfect or not?&lt;br&gt;
start with Singletons design patterns&lt;br&gt;
 #design_patterns&lt;/p&gt;

&lt;h1&gt;
  
  
  SOLID
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>Why used "explain" in MYSQL ?</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Thu, 02 Dec 2021 12:22:44 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/why-used-explain-in-mysql--30np</link>
      <guid>https://dev.to/moatazkhaled93/why-used-explain-in-mysql--30np</guid>
      <description>&lt;h2&gt;
  
  
  Explain
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The EXPLAIN statement provides information about how MySQL executes statements &lt;/li&gt;
&lt;li&gt;works with SELECT, DELETE, INSERT, REPLACE, and UPDATE statements.&lt;/li&gt;
&lt;li&gt;is used with an explainable statement, MySQL displays information from the optimizer about the statement execution plan.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to used Explain
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S35q8jL6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/folsi274woe634apaxya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S35q8jL6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/folsi274woe634apaxya.png" alt="Image description" width="800" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This section describes the output columns produced by EXPLAIN. Later sections provide additional information about the type and Extra columns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3H9ZU7aN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/md2f6vog3csyzn0gls2g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3H9ZU7aN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/md2f6vog3csyzn0gls2g.png" alt="Image description" width="602" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  EXPLAIN Join Types
&lt;/h2&gt;

&lt;p&gt;The type column of EXPLAIN output describes how tables are  joined. In JSON-formatted output, these are found as values of the access_type property. The following list describes the join types, ordered from the best type to the worst:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;system&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The table has only one row (= system table). This is a special case of the const join type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;const&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The table has at most one matching row, which is read at the start of the query. Because there is only one row, values from the column in this row can be regarded as constants by the rest of the optimizer. const tables are very fast because they are read only once.&lt;/p&gt;

&lt;p&gt;const is used when you compare all parts of a PRIMARY KEY or UNIQUE index to constant values. In the following queries, tbl_name can be used as a const table&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   `SELECT * FROM tbl_name WHERE primary_key=1;

   SELECT * FROM tbl_name
    WHERE primary_key_part1=1 AND primary_key_part2=2;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;eq_ref&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One row is read from this table for each combination of rows from the previous tables. Other than the system and const types, this is the best possible join type. It is used when all parts of an index are used by the join and the index is a PRIMARY KEY or UNIQUE NOT NULL index.&lt;/p&gt;

&lt;p&gt;eq_ref can be used for indexed columns that are compared using the = operator. The comparison value can be a constant or an expression that uses columns from tables that are read before this table. In the following examples, MySQL can use an eq_ref join to process ref_table: &lt;br&gt;
      `SELECT * FROM ref_table,other_table&lt;br&gt;
         WHERE ref_table.key_column=other_table.column;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    SELECT * FROM ref_table,other_table
      WHERE ref_table.key_column_part1=other_table.column
      AND ref_table.key_column_part2=1;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;ref&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All rows with matching index values are read from this table for each combination of rows from the previous tables. ref is used if the join uses only a leftmost prefix of the key or if the key is not a PRIMARY KEY or UNIQUE index (in other words, if the join cannot select a single row based on the key value). If the key that is used matches only a few rows, this is a good join type.&lt;/p&gt;

&lt;p&gt;ref can be used for indexed columns that are compared using the = or &amp;lt;=&amp;gt; operator. In the following examples, MySQL can use a ref join to process ref_table: &lt;br&gt;
        `SELECT * FROM ref_table WHERE key_column=expr;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     SELECT * FROM ref_table,other_table
       WHERE ref_table.key_column=other_table.column;

       SELECT * FROM ref_table,other_table
   WHERE ref_table.key_column_part1=other_table.column
      AND ref_table.key_column_part2=1;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;fulltext&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The join is performed using a FULLTEXT index.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ref_or_null&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This join type is like ref, but with the addition that MySQL does an extra search for rows that contain NULL values. This join type optimization is used most often in resolving subqueries. In the following examples, MySQL can use a ref_or_null join to process ref_table: &lt;br&gt;
      &lt;code&gt;SELECT * FROM ref_table&lt;br&gt;
        WHERE key_column=expr OR key_column IS NULL;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;index_merge&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This join type indicates that the Index Merge optimization is used. In this case, the key column in the output row contains a list of indexes used, and key_len contains a list of the longest key parts for the indexes used. For more information, see Section 8.2.1.3, “Index Merge Optimization”.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;unique_subquery&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This type replaces eq_ref for some IN subqueries of the following form: &lt;br&gt;
       &lt;code&gt;value IN (SELECT primary_key FROM single_table WHERE    &lt;br&gt;
        some_expr)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;index_subquery&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This join type is similar to unique_subquery. It replaces IN subqueries, but it works for nonunique indexes in subqueries of the following form: &lt;br&gt;
       &lt;code&gt;value IN (SELECT key_column FROM single_table WHERE &lt;br&gt;
      some_expr)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;range&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Only rows that are in a given range are retrieved, using an index to select the rows. The key column in the output row indicates which index is used. The key_len contains the longest key part that was used. The ref column is NULL for this type.&lt;/p&gt;

&lt;p&gt;range can be used when a key column is compared to a constant using any of the =, &amp;lt;&amp;gt;, &amp;gt;, &amp;gt;=, &amp;lt;, &amp;lt;=, IS NULL, &amp;lt;=&amp;gt;, BETWEEN, LIKE, or IN() operators: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   `SELECT * FROM tbl_name
      WHERE key_column = 10;

    SELECT * FROM tbl_name
      WHERE key_column BETWEEN 10 and 20;

    SELECT * FROM tbl_name
      WHERE key_column IN (10,20,30);

    SELECT * FROM tbl_name
      WHERE key_part1 = 10 AND key_part2 IN (10,20,30);`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;index&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The index join type is the same as ALL, except that the index tree is scanned. This occurs two ways:&lt;/p&gt;

&lt;p&gt;If the index is a covering index for the queries and can be used to satisfy all data required from the table, only the index tree is scanned. In this case, the Extra column says Using index. An index-only scan usually is faster than ALL because the size of the index usually is smaller than the table data.&lt;/p&gt;

&lt;p&gt;A full table scan is performed using reads from the index to look up data rows in index order. Uses index does not appear in the Extra column. &lt;/p&gt;

&lt;p&gt;MySQL can use this join type when the query uses only columns that are part of a single index.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;ALL&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
A full table scan is done for each combination of rows from the previous tables. This is normally not good if the table is the first table not marked const, and usually very bad in all other cases. Normally, you can avoid ALL by adding indexes that enable row retrieval from the table based on constant values or column values from earlier tables. &lt;/p&gt;

</description>
      <category>mysql</category>
    </item>
    <item>
      <title>Types of Array in PHP</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Mon, 26 Jul 2021 19:12:21 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/types-of-array-in-php-2kei</link>
      <guid>https://dev.to/moatazkhaled93/types-of-array-in-php-2kei</guid>
      <description>&lt;p&gt;We have three types of array :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DLqRJ2x0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hump4renbhsi6dwh69ii.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DLqRJ2x0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hump4renbhsi6dwh69ii.png" alt="Alt Text" width="777" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Indexed Array&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;An array with a numeric key is known as the indexed array. Values are stored and accessed in linear order.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I0rhFFhy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgnlweylr4we203udmso.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I0rhFFhy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgnlweylr4we203udmso.png" alt="Alt Text" width="764" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Associative Array&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;An array with strings for indexing elements is known as the associative array. Element values are stored in association with key values rather than in strict linear index order.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8LF8-R9P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/93nzzmfp6m041sx6k268.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8LF8-R9P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/93nzzmfp6m041sx6k268.png" alt="Alt Text" width="800" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Multidimensional Array&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;An array containing one or more arrays within itself is known as a multidimensional array. The values are accessed using multiple indices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7DjdKGKN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34nnhn7fbm7pe4211ddp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7DjdKGKN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34nnhn7fbm7pe4211ddp.png" alt="Alt Text" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
    </item>
    <item>
      <title>PHP 8 &amp; PHP 7</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Thu, 08 Apr 2021 21:42:39 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/php-8-2n63</link>
      <guid>https://dev.to/moatazkhaled93/php-8-2n63</guid>
      <description>&lt;h1&gt;
  
  
  Constructor property promotion
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;PHP 7&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; class Point {

public float $x;
public float $y;
public float $z;

public function __construct(float $x = 0.0, float $y = 0.0, float $z = 0.0) {
    $this-&amp;gt;x = $x;
    $this-&amp;gt;y = $y;
    $this-&amp;gt;z = $z;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PHP 8&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Point {

  public function __construct(public float $x = 0.0,public float $y = 0.0,public float $z = 0.0,) {

  }

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

&lt;/div&gt;

</description>
      <category>php</category>
    </item>
    <item>
      <title>How to write clean code.</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Thu, 08 Apr 2021 12:09:59 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/how-to-write-clean-code-41o0</link>
      <guid>https://dev.to/moatazkhaled93/how-to-write-clean-code-41o0</guid>
      <description>&lt;h1&gt;
  
  
  Good code
&lt;/h1&gt;

&lt;p&gt;At some time we write if statement like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function create($type) {

    if ($type == 1) {
        return "A";
    } elseif ($type == 2) {
        return "B";
    } elseif ($type == 3) {
        return "C";
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;this code is good and worked but not clean code. &lt;/p&gt;

&lt;h1&gt;
  
  
  clean code
&lt;/h1&gt;

&lt;p&gt;we can convert this code to be like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;priviate $array = [1 =&amp;gt; 'A', 2 =&amp;gt; 'B', 3 =&amp;gt; 'C']; 

public function create($type) {


    return key_exists($type, $this-&amp;gt;array)? $this-&amp;gt;array[$type]:false; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>php</category>
    </item>
    <item>
      <title>How To Delete a GitHub Repository</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Thu, 08 Apr 2021 09:40:10 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/how-to-delete-a-github-repository-3l1a</link>
      <guid>https://dev.to/moatazkhaled93/how-to-delete-a-github-repository-3l1a</guid>
      <description>&lt;h1&gt;
  
  
  Delete GitHub repository
&lt;/h1&gt;

&lt;p&gt;In order to delete a GitHub repository, you have to follow the steps described below :&lt;/p&gt;

&lt;p&gt;1- Click on your profile picture at the top right corner&lt;br&gt;
      of the GitHub interface and click on&lt;br&gt;
       &lt;strong&gt;“Your repositories“&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;2- On your repository list, select the GitHub repository&lt;br&gt;
      that you want to delete.&lt;/p&gt;

&lt;p&gt;3- On the repository page, click on &lt;strong&gt;“Settings”&lt;/strong&gt; in the&lt;br&gt;
      menu.&lt;/p&gt;

&lt;p&gt;4- In the repository settings, scroll down until you see &lt;br&gt;
      the &lt;strong&gt;“Danger zone“&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;5- In the &lt;strong&gt;“danger zone”&lt;/strong&gt;, click on “Delete this repository“&lt;br&gt;
      To confirm the GitHub repository deletion, you have to&lt;br&gt;&lt;br&gt;
      type the repository name. When you are done, simply &lt;br&gt;
      click on &lt;br&gt;
    &lt;strong&gt;“I understand the consequences, delete this repository“&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;6- Congratulations, you have successfully deleted your &lt;br&gt;
     GitHub repository!&lt;/p&gt;

</description>
      <category>github</category>
    </item>
    <item>
      <title>the Best way to use Laravel with Nosql Mongodb</title>
      <dc:creator>Moataz khaled</dc:creator>
      <pubDate>Wed, 07 Apr 2021 15:13:19 +0000</pubDate>
      <link>https://dev.to/moatazkhaled93/the-best-way-to-use-laravel-with-nosql-mongodb-3m96</link>
      <guid>https://dev.to/moatazkhaled93/the-best-way-to-use-laravel-with-nosql-mongodb-3m96</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fygpm4Q4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7i5b71x4zqbxqc7c5zs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fygpm4Q4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7i5b71x4zqbxqc7c5zs.png" alt="Alt Text" width="322" height="569"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1 -The first step we need to sure we installed Mongodb in the global environment on the PC.&lt;/p&gt;

&lt;p&gt;2 - Installation&lt;/p&gt;

&lt;p&gt;if ready I will be run in my project this command&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; "$ composer require jenssegers/mongodb"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3-Laravel &lt;/p&gt;

&lt;p&gt;In case your Laravel version does NOT autoload the packages, add the service provider to config/app.php:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Jenssegers\Mongodb\MongodbServiceProvider::class,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;4- Configuration&lt;/p&gt;

&lt;p&gt;You can use MongoDB either as the main database, either as a side database. To do so, add a new MongoDB connection to config/database.php:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     'mongodb' =&amp;gt; [
        'driver' =&amp;gt; 'mongodb',
        'host' =&amp;gt; env('MONGO_DB_HOST','localhost'),
        'port' =&amp;gt; env('MONGO_DB_PORT'),
        'database' =&amp;gt; env('MONGO_DB_DATABASE'),
        'username' =&amp;gt; env('MONGO_DB_USERNAME'),
        'password' =&amp;gt; env('MONGO_DB_PASSWORD'),
        'options' =&amp;gt; []
     ],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if need to used DSN :&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    'mongodb' =&amp;gt; [
        'driver' =&amp;gt; 'mongodb',
        'dsn' =&amp;gt; env('MONGO_DB_DSN'),
        'database' =&amp;gt; env('MONGO_DB_DATABASE'),
    ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;5 - env File   '.env'&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     MONGO_DB_HOST=127.0.0.1
     MONGO_DB_PORT=27017
     MONGO_DB_DATABASE={my_db}
     MONGO_DB_USERNAME={my_user}
     MONGO_DB_PASSWORD={my_password}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;if need to used DSN :&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    MONGO_DB_DSN= {my_link_dsn}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>laravel</category>
      <category>mongodb</category>
      <category>php</category>
    </item>
  </channel>
</rss>
