<?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>Forem: Md. Abdur rahman</title>
    <description>The latest articles on Forem by Md. Abdur rahman (@marbabu).</description>
    <link>https://forem.com/marbabu</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%2F731335%2F7101522d-0294-42f0-bcd0-7b6fa627a9eb.png</url>
      <title>Forem: Md. Abdur rahman</title>
      <link>https://forem.com/marbabu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/marbabu"/>
    <language>en</language>
    <item>
      <title>Render Wasabi Cloud File</title>
      <dc:creator>Md. Abdur rahman</dc:creator>
      <pubDate>Sun, 21 May 2023 13:40:00 +0000</pubDate>
      <link>https://forem.com/marbabu/render-wasabi-cloud-file-161c</link>
      <guid>https://forem.com/marbabu/render-wasabi-cloud-file-161c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Wasabi&lt;/strong&gt; is a cloud object storage that is compatible with Amazon S3. It can be integrated with AWS, Google Cloud or Microsoft Azure solutions, using the same protocol and tools. Wasabi is a value-oriented, high-performance, low-latency, and high-availability cloud object storage offering.&lt;/p&gt;

&lt;p&gt;Generating a pre-signed S3 URL for uploading an object in your application code with AWS SDK for PHP (V2)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
You can make a helper function like this inside app/Helpers/funtions.php.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (!function_exists('renderWasabiCloudFile')) {
    function renderWasabiCloudFile($fileLocationInsideYourBucket)
    {
        $s3 = new \Aws\S3\S3Client([
            'endpoint' =&amp;gt; config('filesystems.disks.wasabi.endpoint'),
            'region' =&amp;gt; config('filesystems.disks.wasabi.region'),
            'version' =&amp;gt; 'latest',
            'credentials' =&amp;gt; array(
                'key' =&amp;gt; config('filesystems.disks.wasabi.key'),
                'secret' =&amp;gt; config('filesystems.disks.wasabi.secret'),
            )
        ]);

        $cmd = $s3-&amp;gt;getCommand('GetObject', [
            'Bucket' =&amp;gt; config('filesystems.disks.wasabi.bucket'),
            'Key' =&amp;gt; $fileLocationInsideYourBucket, //hYTYRT56.jpg
            'ACL' =&amp;gt; 'public-read',
        ]);

        $request = $s3-&amp;gt;createPresignedRequest($cmd, '+20 minutes');

        $fileUrl = (string)$request-&amp;gt;getUri();

        return $fileUrl;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Now, call the function and pass $fileUrl from your db.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img class="img-fluid" src={{renderWasabiCloudFile($fileUrl)}}&amp;gt; //this url would come from your database (file path url)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;blockquote&gt;
&lt;p&gt;You can also follow up the official guidance &lt;a href="https://wasabi-support.zendesk.com/hc/en-us/articles/360022853592"&gt;Generate pre-signed urls&lt;/a&gt; to learn more.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>wasabi</category>
      <category>laravel</category>
      <category>aws</category>
      <category>php</category>
    </item>
    <item>
      <title>Wasabi Cloud Storage with Laravel 9</title>
      <dc:creator>Md. Abdur rahman</dc:creator>
      <pubDate>Sun, 21 May 2023 13:01:00 +0000</pubDate>
      <link>https://forem.com/marbabu/wasabi-cloud-storage-with-laravel-9-b0j</link>
      <guid>https://forem.com/marbabu/wasabi-cloud-storage-with-laravel-9-b0j</guid>
      <description>&lt;p&gt;&lt;strong&gt;Wasabi&lt;/strong&gt; is a cloud object storage that is compatible with Amazon S3. It can be integrated with AWS, Google Cloud or Microsoft Azure solutions, using the same protocol and tools. Wasabi is a value-oriented, high-performance, low-latency, and high-availability cloud object storage offering.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step - 1: Set up your laravel app enviroment (.env file) with your wasabi credentials like this.&lt;/strong&gt;&lt;/p&gt;

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

WAS_ACCESS_KEY_ID=4I349UKY85N1FR3D4BBW2
WAS_SECRET_ACCESS_KEY=Z1FOT1cWCuH7zDtEMv6pGZ9SmA2yspno7G
WAS_DEFAULT_REGION=ap-northeast-1
WAS_BUCKET=mybucket
WAS_URL=https://s3.ap-northeast-1.wasabisys.com


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

&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Step - 2: The S3 driver configuration&lt;/strong&gt; information is located in your config/filesystems.php configuration file. This file contains an example configuration array for an S3 driver. You are free to modify this array with your own S3 configuration and credentials.&lt;/p&gt;

&lt;p&gt;So, add your wasabi driver configuration information to config/filesystems.php&lt;/p&gt;

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

&amp;lt;?php

return [

    'default' =&amp;gt; env('FILESYSTEM_DRIVER', 'local'),

    'cloud' =&amp;gt; env('FILESYSTEM_CLOUD', 's3'),

    'disks' =&amp;gt; [

        'local' =&amp;gt; [
            'driver' =&amp;gt; 'local',
            'root' =&amp;gt; storage_path('app'),
        ],

        'public' =&amp;gt; [
            'driver' =&amp;gt; 'local',
            'root' =&amp;gt; storage_path('app/public'),
            'url' =&amp;gt; env('APP_URL').'/storage',
            'visibility' =&amp;gt; 'public',
        ],


        'wasabi' =&amp;gt; [
            'driver' =&amp;gt; 's3',
            'key' =&amp;gt; env('WAS_ACCESS_KEY_ID'),
            'secret' =&amp;gt; env('WAS_SECRET_ACCESS_KEY'),
            'region' =&amp;gt; env('WAS_DEFAULT_REGION'),
            'bucket' =&amp;gt; env('WAS_BUCKET'),
            'endpoint' =&amp;gt; 'https://s3.wasabisys.com'
        ],

    ],

];


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

&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Step - 3: Before using the S3 driver, you will need to install the Flysystem S3 package&lt;/strong&gt; via the Composer package manager:&lt;/p&gt;

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

composer require league/flysystem-aws-s3-v3


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

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Remember to give permission at your bucket access control.&lt;br&gt;
'object write and read access' should have to enable before upload any file. like this - &lt;/p&gt;&lt;/li&gt;
&lt;li&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%2Fiyxxkd09i2xzmt0wtqv2.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%2Fiyxxkd09i2xzmt0wtqv2.png" alt="give your bucket access control from bucket settings"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Step - 4: Finally, you can upload your media file&lt;/strong&gt; to your bucket of wasabi cloud storage using this -&lt;/p&gt;

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

\Illuminate\Support\Facades\Storage::disk('wasabi')&amp;gt;put($file, $fileContents, 'public');


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

&lt;/div&gt;

&lt;p&gt;check if file not exist and upload at your bucket-&lt;/p&gt;

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

if (!\Illuminate\Support\Facades\Storage::disk('wasabi')-&amp;gt;exists($fileLocationInsideYourBucket)) {
    \Illuminate\Support\Facades\Storage::disk('wasabi')-&amp;gt;put($file, $fileContents, 'public');
 }


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

&lt;/div&gt;







&lt;blockquote&gt;
&lt;p&gt;You can also follow up the official guidance &lt;a href="https://wasabi-support.zendesk.com/hc/en-us/articles/360035684991-How-do-I-use-Laravel-with-Wasabi-" rel="noopener noreferrer"&gt;Wasabi Laravel&lt;/a&gt; to learn more.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>wasabi</category>
      <category>laravel</category>
      <category>amazon</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Create Wasabi Bucket and Pocilies</title>
      <dc:creator>Md. Abdur rahman</dc:creator>
      <pubDate>Sun, 21 May 2023 12:51:00 +0000</pubDate>
      <link>https://forem.com/marbabu/create-wasabi-bucket-and-pocilies-24o0</link>
      <guid>https://forem.com/marbabu/create-wasabi-bucket-and-pocilies-24o0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Wasabi&lt;/strong&gt; is a cloud object storage that is compatible with Amazon S3. It can be integrated with AWS, Google Cloud or Microsoft Azure solutions, using the same protocol and tools. Wasabi is a value-oriented, high-performance, low-latency, and high-availability cloud object storage offering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step - 1: First you have to set up wasabi account and create bucket.&lt;/strong&gt; &lt;a href="https://wasabi-support.zendesk.com/hc/en-us/articles/115001405031-How-easy-is-it-to-get-started-with-Wasabi-" rel="noopener noreferrer"&gt;Get started with Wasabi?&lt;/a&gt;. or follow below steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&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%2Fe23md10vush5n6s8q45r.png" alt="set bucket name and region"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&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%2Fkce10qkmgy3bz63ybcot.png" alt="click next"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&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%2Fvxvk724snl35jua5u75z.png" alt="click create bucket"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Step - 2: Create IAM user.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9y8sqsp8h9il4jfnkcpy.png" rel="noopener noreferrer"&gt;select username and type of access&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;with appropriate permissions attached to the user for performing required action(s)&lt;/p&gt;




&lt;ul&gt;
&lt;li&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%2Fd5zr9ynm28rrl4xoek7r.png" alt="group - nothing to change"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&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%2F7ksvsau88bucoh7fu9n8.png" alt="policies"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&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%2F8sswq45tcgoct2rdlj3c.png" alt="save the generated access key"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Step - 3: Then you need to generate bucket policy from [AWS Policy Generator.]&lt;/strong&gt;(&lt;a href="https://awspolicygen.s3.amazonaws.com/policygen.html" rel="noopener noreferrer"&gt;https://awspolicygen.s3.amazonaws.com/policygen.html&lt;/a&gt;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&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%2F96fafik3hxrbiprjn4ww.png" alt="select policy type"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&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%2Fi1qpo6c2z8wnd643ygcs.png" alt="copy IAM users ARN and paste it to add statement's principle of aws policy generator page"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&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%2Fe78v8catj8awn5mk97i7.png" alt="copy your bucket policy editors ARN and paste it to add statement's ARN of aws policy generator page"&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvr6ha5ctvi8oy5r8fu5.png" rel="noopener noreferrer"&gt;select actions and add statement of aws policy generator&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;You'll get this statement list.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&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%2F9taice9wokrkrqsvlvvx.png" alt="1st statement list like this"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, &lt;strong&gt;add one more statement&lt;/strong&gt; and generate policy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&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%2Fs1lwoxhym9p1rlf005bm.png" alt="add 2nd statement"&gt;
&lt;/li&gt;
&lt;/ul&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%2Fl7xq08pb1mrdx75lyuaf.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%2Fl7xq08pb1mrdx75lyuaf.png" alt="you'll get Policy Json Document, copy it"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step - 4: Save Policies of your bucket settings.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&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%2Fove16epc4rkz5de4fhts.png" alt="paste Policy Json, wait and save"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;console will automatically show success message of your policy then save it.&lt;/p&gt;




</description>
      <category>wasabicloud</category>
      <category>aws</category>
      <category>bucketpolicy</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
