-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from omaralalwi/support-store-pdf-files-to-s3
support store pdf files to s3 and local storage
- Loading branch information
Showing
18 changed files
with
544 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.idea | ||
/.vagrant | ||
/vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Omaralalwi\Gpdf\Clients; | ||
|
||
use Omaralalwi\Gpdf\Enums\GpdfSettingKeys; | ||
use Omaralalwi\Gpdf\GpdfConfig; | ||
|
||
class S3Client | ||
{ | ||
protected $gpdfConfig; | ||
|
||
public function __construct(GpdfConfig $gpdfConfig) | ||
{ | ||
$this->gpdfConfig = $gpdfConfig; | ||
} | ||
|
||
public function initilizeClient() | ||
{ | ||
return new \Aws\S3\S3Client([ | ||
'region' => $this->gpdfConfig->get(GpdfSettingKeys::AWS_REGION), | ||
'credentials' => [ | ||
'key' => $this->gpdfConfig->get(GpdfSettingKeys::AWS_KEY), | ||
'secret' => $this->gpdfConfig->get(GpdfSettingKeys::AWS_SECRET), | ||
], | ||
]); | ||
} | ||
|
||
public function getBucket() | ||
{ | ||
return $this->gpdfConfig->get(GpdfSettingKeys::AWS_BUCKET); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Omaralalwi\Gpdf\Css; | ||
|
||
use dompdf\Css\Property\AbstractProperty; | ||
|
||
class CustomBoxShadow | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Omaralalwi\Gpdf\Enums; | ||
|
||
class GpdfStorageDrivers | ||
{ | ||
const LOCAL = 'local'; | ||
const S3 = 's3'; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Omaralalwi\Gpdf\Factories; | ||
|
||
use Omaralalwi\Gpdf\Enums\GpdfSettingKeys; | ||
use Omaralalwi\Gpdf\Enums\GpdfStorageDrivers; | ||
use Omaralalwi\Gpdf\Services\{S3Service, LocalFileService}; | ||
use Omaralalwi\Gpdf\Clients\S3Client; | ||
|
||
class StorageServiceFactory | ||
{ | ||
public function getStorageService($driver, $gpdfConfig) | ||
{ | ||
switch ($driver) { | ||
case GpdfStorageDrivers::S3: | ||
return new S3Service(new S3Client($gpdfConfig)); | ||
case GpdfStorageDrivers::LOCAL: | ||
default: | ||
return new LocalFileService(); | ||
} | ||
} | ||
} |
Oops, something went wrong.