« Génération de QRCode Laravel » : différence entre les versions
De Gandal
(Page créée avec « <nowiki>https://github.com/endroid/qr-code</nowiki> SimpleSoftwareIO/simple-qrcode: An easy-to-use PHP QrCode generator with first-party support for Laravel. (github.com) <syntaxhighlight lang="php"> <?php namespace App\Http\Controllers; use App\Mail\TicketPurchased; use App\Models\Participant; use App\Models\Ticket; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Mail; use SimpleSoftwareIO\QrCode\Facades\QrCode;... ») |
Aucun résumé des modifications |
||
| (Une version intermédiaire par le même utilisateur non affichée) | |||
| Ligne 1 : | Ligne 1 : | ||
<nowiki>https://github.com/endroid/qr-code</nowiki> | Version plus complète : <nowiki>https://github.com/endroid/qr-code</nowiki> | ||
SimpleSoftwareIO/simple-qrcode: An easy-to-use PHP QrCode generator with first-party support for Laravel. (github.com) | SimpleSoftwareIO/simple-qrcode: An easy-to-use PHP QrCode generator with first-party support for Laravel. (github.com) | ||
| Ligne 5 : | Ligne 5 : | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
<?php | <?php | ||
/* Un exemple*/ | |||
private function generateQrCode($text) | |||
{ | { | ||
// | $result = Builder::create() | ||
->writer(new PngWriter()) | |||
->writerOptions([]) | |||
->data($text) | |||
->encoding(new Encoding('UTF-8')) | |||
->errorCorrectionLevel(ErrorCorrectionLevel::High) | |||
->size(300) | |||
->margin(10) | |||
->roundBlockSizeMode(RoundBlockSizeMode::Margin) | |||
->foregroundColor(new Color(0, 0, 0)) | |||
->backgroundColor(new Color(255, 255, 255)) | |||
->logoPath("https://www.mouleagaufres.com/wp-content/uploads/2022/03/logoMAG-blanc.png") | |||
->logoResizeToWidth(50) | |||
->logoPunchoutBackground(true) | |||
->validateResult(false) | |||
->build(); | |||
return $result->getString(); | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Dernière version du 11 juin 2024 à 15:52
Version plus complète : https://github.com/endroid/qr-code
SimpleSoftwareIO/simple-qrcode: An easy-to-use PHP QrCode generator with first-party support for Laravel. (github.com)
<?php
/* Un exemple*/
private function generateQrCode($text)
{
$result = Builder::create()
->writer(new PngWriter())
->writerOptions([])
->data($text)
->encoding(new Encoding('UTF-8'))
->errorCorrectionLevel(ErrorCorrectionLevel::High)
->size(300)
->margin(10)
->roundBlockSizeMode(RoundBlockSizeMode::Margin)
->foregroundColor(new Color(0, 0, 0))
->backgroundColor(new Color(255, 255, 255))
->logoPath("https://www.mouleagaufres.com/wp-content/uploads/2022/03/logoMAG-blanc.png")
->logoResizeToWidth(50)
->logoPunchoutBackground(true)
->validateResult(false)
->build();
return $result->getString();
}
