Download the PHP package vdhicts/laravel-csr-generator without Composer
On this page you can find all versions of the php package vdhicts/laravel-csr-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vdhicts/laravel-csr-generator
More information about vdhicts/laravel-csr-generator
Files in vdhicts/laravel-csr-generator
Package laravel-csr-generator
Short Description Easily generate a CSR with Laravel.
License MIT
Homepage https://github.com/vdhicts/laravel-csr-generator
Informations about the package laravel-csr-generator
CSR generator
PHP offers several methods to help generate a CSR and private key. Unfortunately, some CSR parts (i.e. subject alternative names) are not easily usable. This Laravel package aims to make the procedure easier within your Laravel application.
Requirements
This Laravel package requires PHP 8.1 or higher, Laravel 9+ and you will need the openssl extension as that's required
for the openssl_*
php functions used by this package.
Installation
This package can be used in any Laravel project.
You can install the package via composer:
composer require vdhicts/laravel-csr-generator
Usage
This package is an easy-to-use wrapper around the PHP functions.
Getting started
All steps can be performed individually to suit all your needs.
Generate private key
The private key can be generated with the PrivateKeyGenerator
. It's possible to manually determine the key bits and
type. Additional options can be provided too. The generator will return null when failed or an instance of PrivateKey
.
You can access the OpenSSLAsymmetricKey
as a property.
Export private key as string
To convert the private key to a string, use the export
method on the PrivateKey
object or cast the object to a
string:
Generate CSR
To generate the CSR, generate the private key and create the subject fields first. The generator will return null when
failed or an instance of Csr
.
You can access the OpenSSLCertificateSigningRequest
as a property.
Subject alternative names & your own config
When providing subject alternative names, the config file from the additional options will be overwritten. This is
required to provide the subject alternative names as those can't be provided directly to the openssl_
functions
built in PHP. If you need to provide subject alternative names and a custom config, leave the subject alternative names
in the SubjectFields
empty and provide your config with the SAN section:
To help you create the config file, it's possible to publish the view for the config file. This view is used by default for generating the config with the subject alternative names.
Export CSR as string
To convert the CSR to a string, use the export
method on the Csr
object or cast the object to a string:
Custom configuration
Some defaults are set which are used by the generators. To change those defaults, publish the configuration file with:
Tests
Unit tests are available in the tests
folder. Run with:
composer test
When you want a code coverage report which will be generated in the build/report
folder. Run with:
composer test-coverage
Contribution
Any contribution is welcome, see the Contributing guidelines.
Security
If you discover any security-related issues in this or other packages of Vdhicts, please email [email protected] instead of using the issue tracker.
License
This package is open-sourced software licensed under the MIT license.
About Vdhicts
Vdhicts is the name of my company for which I work as a freelancer. Vdhicts develops and implements IT solutions for businesses and educational institutions.
All versions of laravel-csr-generator with dependencies
ext-openssl Version *
laravel/framework Version ^9.0|^10.0|^11.0
laravel/pint Version ^1.7
spatie/laravel-package-tools Version ^1.11