-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ff53d40
Showing
92 changed files
with
11,947 additions
and
0 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,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
|
||
[docker-compose.yml] | ||
indent_size = 4 |
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,52 @@ | ||
APP_NAME=Laravel | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost | ||
|
||
LOG_CHANNEL=stack | ||
LOG_DEPRECATIONS_CHANNEL=null | ||
LOG_LEVEL=debug | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE=zatca_qr | ||
DB_USERNAME=root | ||
DB_PASSWORD= | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
FILESYSTEM_DRIVER=local | ||
QUEUE_CONNECTION=sync | ||
SESSION_DRIVER=file | ||
SESSION_LIFETIME=120 | ||
|
||
MEMCACHED_HOST=127.0.0.1 | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_MAILER=smtp | ||
MAIL_HOST=mailhog | ||
MAIL_PORT=1025 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM_ADDRESS=null | ||
MAIL_FROM_NAME="${APP_NAME}" | ||
|
||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_DEFAULT_REGION=us-east-1 | ||
AWS_BUCKET= | ||
AWS_USE_PATH_STYLE_ENDPOINT=false | ||
|
||
PUSHER_APP_ID= | ||
PUSHER_APP_KEY= | ||
PUSHER_APP_SECRET= | ||
PUSHER_APP_CLUSTER=mt1 | ||
|
||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | ||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" |
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,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
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,15 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
docker-compose.override.yml | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
/.idea | ||
/.vscode |
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,14 @@ | ||
php: | ||
preset: laravel | ||
version: 8 | ||
disabled: | ||
- no_unused_imports | ||
finder: | ||
not-name: | ||
- index.php | ||
- server.php | ||
js: | ||
finder: | ||
not-name: | ||
- webpack.mix.js | ||
css: true |
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,34 @@ | ||
<p align="center"><br><img src="./public/images/qr_scan_me.png" width="150"></p> | ||
|
||
A Laravel application to generate QR Codes required for e-invoicing standard by [ZATCA](https://zatca.gov.sa/en/E-Invoicing/Pages/default.aspx) in Saudi Arabia. | ||
You can use it as a ready-made code template for your projects to support ZATCA QR codes. | ||
|
||
This application is built using the following libraries: | ||
|
||
- [Salla ZATCA](https://github.com/SallaApp/ZATCA) implementation. | ||
- [Chillerlan](https://github.com/chillerlan/php-qrcode) QR Code library | ||
- Barryvdh [DOMPDF Wrapper](https://github.com/barryvdh/laravel-dompdf) for Laravel. | ||
|
||
## Features | ||
|
||
- Download QR code image directly. | ||
- Save QR code image to server. | ||
- Generate PDF with QR code image. | ||
- Add an image in the center of the QR code image. | ||
|
||
## Usage | ||
|
||
To get started, this is all you need to do: | ||
|
||
```bash | ||
$ git clone https://github.com/mostafaaminflakes/ZATCA-QR-Code-Implementation.git | ||
$ cd ZATCA-QR-Code-Implementation | ||
$ composer install | ||
$ cp .env.example .env | ||
$ php artisan key:generate | ||
$ php artisan serve | ||
``` | ||
|
||
## Contributions | ||
|
||
For bug reports or feature requests, please share them with us [here](https://github.com/mostafaaminflakes/ZATCA-QR-Code-Implementation/issues). |
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,18 @@ | ||
<?php | ||
|
||
namespace App\Classes; | ||
|
||
use chillerlan\QRCode\QROptions; | ||
|
||
/** | ||
* @property int $logoSpaceWidth | ||
* @property int $logoSpaceHeight | ||
* | ||
* @noinspection PhpIllegalPsrClassPathInspection | ||
*/ | ||
class LogoOptions extends QROptions | ||
{ | ||
// size in QR modules, multiply with QROptions::$scale for pixel size | ||
protected int $logoSpaceWidth; | ||
protected int $logoSpaceHeight; | ||
} |
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,84 @@ | ||
<?php | ||
|
||
/** | ||
* Class QRImageWithLogo | ||
* | ||
* @filesource QRImageWithLogo.php | ||
* @created 18.11.2020 | ||
* @package chillerlan\QRCodeExamples | ||
* @author smiley <smiley@chillerlan.net> | ||
* @copyright 2020 smiley | ||
* @license MIT | ||
* | ||
* @noinspection PhpComposerExtensionStubsInspection | ||
*/ | ||
|
||
// namespace chillerlan\QRCodeExamples; | ||
namespace App\Classes; | ||
|
||
use chillerlan\QRCode\Output\{QRCodeOutputException, QRImage}; | ||
|
||
use function imagecopyresampled, imagecreatefrompng, imagesx, imagesy, is_file, is_readable; | ||
|
||
/** | ||
* @property \chillerlan\QRCodeExamples\LogoOptions $options | ||
*/ | ||
class QRImageWithLogo extends QRImage | ||
{ | ||
|
||
/** | ||
* @param string|null $file | ||
* @param string|null $logo | ||
* | ||
* @return string | ||
* @throws \chillerlan\QRCode\Output\QRCodeOutputException | ||
*/ | ||
public function dump(string $file = null, string $logo = null): string | ||
{ | ||
// set returnResource to true to skip further processing for now | ||
$this->options->returnResource = true; | ||
|
||
// of course you could accept other formats too (such as resource or Imagick) | ||
// i'm not checking for the file type either for simplicity reasons (assuming PNG) | ||
if (!is_file($logo) || !is_readable($logo)) { | ||
throw new QRCodeOutputException('invalid logo'); | ||
} | ||
|
||
$this->matrix->setLogoSpace( | ||
$this->options->logoSpaceWidth, | ||
$this->options->logoSpaceHeight | ||
// not utilizing the position here | ||
); | ||
|
||
// there's no need to save the result of dump() into $this->image here | ||
parent::dump($file); | ||
|
||
$im = imagecreatefrompng($logo); | ||
|
||
// get logo image size | ||
$w = imagesx($im); | ||
$h = imagesy($im); | ||
|
||
// set new logo size, leave a border of 1 module (no proportional resize/centering) | ||
$lw = ($this->options->logoSpaceWidth - 2) * $this->options->scale; | ||
$lh = ($this->options->logoSpaceHeight - 2) * $this->options->scale; | ||
|
||
// get the qrcode size | ||
$ql = $this->matrix->size() * $this->options->scale; | ||
|
||
// scale the logo and copy it over. done! | ||
imagecopyresampled($this->image, $im, ($ql - $lw) / 2, ($ql - $lh) / 2, 0, 0, $lw, $lh, $w, $h); | ||
|
||
$imageData = $this->dumpImage(); | ||
|
||
if ($file !== null) { | ||
$this->saveToFile($imageData, $file); | ||
} | ||
|
||
if ($this->options->imageBase64) { | ||
$imageData = 'data:image/' . $this->options->outputType . ';base64,' . base64_encode($imageData); | ||
} | ||
|
||
return $imageData; | ||
} | ||
} |
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 App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire')->hourly(); | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.php'); | ||
} | ||
} |
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,41 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
use Throwable; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array<int, class-string<Throwable>> | ||
*/ | ||
protected $dontReport = [ | ||
// | ||
]; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array<int, string> | ||
*/ | ||
protected $dontFlash = [ | ||
'current_password', | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Register the exception handling callbacks for the application. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->reportable(function (Throwable $e) { | ||
// | ||
}); | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; | ||
use Illuminate\Foundation\Bus\DispatchesJobs; | ||
use Illuminate\Foundation\Validation\ValidatesRequests; | ||
use Illuminate\Routing\Controller as BaseController; | ||
|
||
class Controller extends BaseController | ||
{ | ||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; | ||
} |
Oops, something went wrong.