### Get Package from Bitbucket
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Registers a package's dependencies from Bitbucket using the `packager:get` command. Requires the `--host=bitbucket` flag.
```bash
php artisan packager:get https://github.com/author/repository --host=bitbucket
```
--------------------------------
### Install Security Checker
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Installs the SensioLabs security checker dependency using Composer. This is a prerequisite for the 'packager:check' command.
```bash
composer require sensiolabs/security-checker
```
--------------------------------
### List All Packages in Directory
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Displays an overview of all packages found in the `/packages` directory of the application. This command provides a quick way to see installed packages.
```bash
php artisan packager:list
```
--------------------------------
### Create New Package (Standard)
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Creates a new Laravel package using the `packager:new` command. Requires vendor and package names as arguments. It automates directory creation, skeleton pulling, and service provider setup.
```bash
php artisan packager:new my-vendor my-package
```
--------------------------------
### Install Laravel Packager via Composer
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Installs the Laravel Packager package using Composer. It is recommended to install it as a development dependency.
```bash
composer require jeroen-g/laravel-packager --dev
```
--------------------------------
### Publish Package to GitHub using Laravel Packager
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Initializes a Git repository and publishes a package to GitHub. This command initializes Git if it doesn't exist, adds a remote origin, and pushes to the master branch. Prerequisites include Git installation and an empty GitHub repository.
```bash
php artisan packager:publish my-vendor/my-package https://github.com/my-vendor/my-package
```
--------------------------------
### Get Package Dependencies
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Registers a package's dependencies in the application's composer.json file using the `packager:get` command. It downloads the package without cloning the repository.
```bash
php artisan packager:get https://github.com/author/repository
```
--------------------------------
### Check Package Command
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Checks a specified package for security vulnerabilities using SensioLabs security checker. This command requires the sensiolabs/security-checker package to be installed.
```bash
php artisan packager:check my-vendor my-package
```
--------------------------------
### Get Package with Specific Branch
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Registers a package's dependencies using `packager:get`, specifying a particular branch to download. This allows for version control flexibility.
```bash
php artisan packager:get https://github.com/author/repository --branch=develop
```
--------------------------------
### List Installed Laravel Packages with Packager
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Displays a list of all packages installed using Laravel Packager. Optionally, it can include Git status information such as commits behind the origin and the current branch.
```bash
php artisan packager:list
php artisan packager:list --git
```
--------------------------------
### Get Package with Custom Vendor/Package Name
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Registers a package's dependencies using `packager:get`, overriding the vendor and package name derived from the URL with explicitly provided names.
```bash
php artisan packager:get https://github.com/author/repository my-vendor my-package
```
--------------------------------
### Security Check for Package using Laravel Packager
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Checks a package for known security vulnerabilities using SensioLabs Security Checker. It requires the `sensiolabs/security-checker` package to be installed via Composer and reports vulnerabilities with severity levels and advisory links.
```bash
composer require sensiolabs/security-checker
php artisan packager:check my-vendor my-package
```
--------------------------------
### Conveyor Class Usage for Package Metadata and Operations
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Demonstrates the usage of the Conveyor class for managing package metadata, resolving paths, downloading package skeletons, and performing Composer operations programmatically. It covers setting vendor/package names, getting paths, and executing composer require/remove.
```php
use JeroenGPackagerConveyor;
$conveyor = new Conveyor();
// Set vendor and package
$conveyor->vendor('my-vendor');
$conveyor->package('my-package');
// Get paths
$packagesPath = $conveyor->packagesPath(); // base_path('packages')
$vendorPath = $conveyor->vendorPath(); // base_path('packages/my-vendor')
$packagePath = $conveyor->packagePath(); // base_path('packages/my-vendor/my-package')
// Get formatted names
$vendorStudly = $conveyor->vendorStudly(); // MyVendor
$packageStudly = $conveyor->packageStudly(); // MyPackage
$vendorKebab = $conveyor->vendorKebab(); // my-vendor
$packageKebab = $conveyor->packageKebab(); // my-package
// Download skeleton
$conveyor->downloadSkeleton('https://github.com/author/skeleton/archive/master.zip');
// Download from GitHub
$conveyor->downloadFromGithub(
'https://github.com/author/repo/archive/master.zip',
'repo',
'master'
);
// Composer operations
$conveyor->addPathRepository(); // Add path repo to composer.json
$conveyor->requirePackage(); // Run composer require
$conveyor->removePackage(); // Run composer remove
$conveyor->removePathRepository(); // Remove path repo from composer.json
$conveyor->dumpAutoloads(); // Run composer dump-autoload
```
--------------------------------
### Create New Package (Interactive)
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Creates a new Laravel package interactively using the `packager:new --i` command. This allows for detailed configuration of the package's composer.json file during creation.
```bash
php artisan packager:new my-vendor my-package --i
```
```bash
php artisan packager:new --i
```
--------------------------------
### Create New Package with Custom Skeleton
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Creates a new Laravel package using a specific Git repository as a custom skeleton. The skeleton URL is provided via the `--skeleton` flag.
```bash
php artisan packager:new my-vendor my-package --skeleton="http://github.com/path/to/archive/master.zip"
```
--------------------------------
### Create New Package (Vendor/Package Slug)
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Creates a new Laravel package by specifying the vendor and package name using a forward slash in the `packager:new` command. This is an alternative to using a space.
```bash
php artisan packager:new my-vendor/my-package
```
--------------------------------
### Publish Package Command
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Publishes a specified package to a given GitHub URL. This command is executed via Artisan and requires the package vendor, name, and repository URL.
```bash
php artisan packager:publish my-vendor my-package https://github.com/my-vendor/my-package
```
--------------------------------
### Create New Laravel Package with Packager
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Automates the creation of a new Laravel package, including directory structure, skeleton download, placeholder replacement, composer configuration, and service provider registration. Supports interactive mode and custom skeleton URLs.
```bash
php artisan packager:new my-vendor my-package
php artisan packager:new my-vendor/my-package
php artisan packager:new my-vendor my-package --i
php artisan packager:new --i
php artisan packager:new my-vendor my-package --skeleton="https://github.com/custom/skeleton/archive/master.zip"
```
--------------------------------
### Publish Packager Configuration
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Publishes the configuration file for Laravel Packager. This allows customization of settings, such as the default package skeleton.
```bash
php artisan vendor:publish --provider="JeroenG\Packager\PackagerServiceProvider"
```
--------------------------------
### Clone Package Repository
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Clones an entire Git repository for a package using the `packager:git` command. This is useful when you need the full repository history.
```bash
php artisan packager:git https://github.com/author/repository
```
--------------------------------
### Enable Package Service Provider using Laravel Packager
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Enables a package by registering its service provider in `config/app.php`. It automatically converts kebab-case names to StudlyCase for the provider class and ensures proper insertion into the providers array.
```bash
php artisan packager:enable my-vendor my-package
```
--------------------------------
### Download Existing Laravel Package from GitHub/Bitbucket
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Downloads an existing Laravel package from a GitHub or Bitbucket repository as a ZIP archive, without cloning the Git history. It registers the package as a path repository in composer.json. Supports specifying branches and custom vendor/package names.
```bash
php artisan packager:get https://github.com/author/repository
php artisan packager:get https://github.com/author/repository --branch=develop
php artisan packager:get https://bitbucket.org/author/repository --host=bitbucket
php artisan packager:get https://github.com/author/repository custom-vendor custom-package
```
--------------------------------
### List Packages with Git Status
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Displays an overview of all packages in the `/packages` directory, including their Git status (branch, commit differences). This option is only applicable to Git repositories.
```bash
php artisan packager:list --git
```
--------------------------------
### Publish Tests for Specific Package
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Publishes the tests for a specific package to the `tests/packages` directory. This command targets a single package identified by its vendor and package name.
```bash
php artisan packager:tests my-vendor my-package
```
--------------------------------
### Replace Placeholders in Template Files with Wrapping Class (PHP)
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
The Wrapping class handles placeholder replacement in template files for package scaffolding. It allows defining multiple string replacements and applying them to single files or entire directories. Dependencies include the JeroenG\Packager\Wrapping class.
```php
use JeroenG\Packager\Wrapping;
$wrapping = new Wrapping();
// Define replacements
$wrapping->replace(':uc:vendor', 'MyVendor')
->replace(':uc:package', 'MyPackage')
->replace(':lc:vendor', 'myvendor')
->replace(':lc:package', 'mypackage')
->replace(':author_name', 'John Doe')
->replace(':author_email', 'john@example.com')
->replace(':license', 'MIT');
// Replace in single file
$wrapping->fillInFile('/path/to/template.php', '/path/to/output.php');
// Replace in all files in directory (recursive)
$wrapping->fill('/path/to/package');
// Array replacement
$wrapping->replace(
[':uc:vendor', ':uc:package'],
['MyVendor', 'MyPackage']
);
```
--------------------------------
### Publish Package Tests
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Publishes the tests for all maintained packages in the `/packages` directory to the `tests/packages` directory of the main application. This facilitates integrated testing.
```bash
php artisan packager:tests
```
--------------------------------
### Configure Laravel Packager Options (PHP)
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
This PHP configuration array defines various options for the Laravel Packager, including the default skeleton URL, SSL certificate verification settings, Composer operation timeout, and default author information. These settings are typically located in the `config/packager.php` file and can be overridden by environment variables.
```php
return [
// Skeleton URL - default package template
'skeleton' => 'https://github.com/Jeroen-G/packager-skeleton/archive/master.zip',
// SSL certificate verification (set to false on Windows if issues occur)
'curl_verify_cert' => env('CURL_VERIFY', true),
// Timeout for composer operations (seconds)
'timeout' => '60',
// Default author information
'author_name' => 'Author Name',
'author_email' => 'author@email.com',
'author_homepage' => 'http://author.com',
'license' => 'MIT',
];
```
--------------------------------
### File System Operations for Package Management with FileHandler Trait (PHP)
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
The FileHandler trait provides essential file system operations for package management, including directory creation and removal, file downloading, archive extraction, and cleanup. It supports various archive formats like ZIP, TAR, TAR.GZ, and TAR.XZ. Dependencies include the JeroenG\Packager\FileHandler trait.
```php
use JeroenG\Packager\FileHandler;
class MyClass {
use FileHandler;
protected $vendor = 'my-vendor';
protected $package = 'my-package';
public function example() {
// Create directory
$this->makeDir('/path/to/directory');
// Remove directory recursively
$this->removeDir('/path/to/directory');
// Check if package exists
$this->checkIfPackageExists(); // Throws RuntimeException if exists
// Download file
$this->download('/local/file.zip', 'https://example.com/file.zip');
// Extract archive (supports .zip, .tar, .tar.gz, .tar.xz)
$this->extract('/path/to/archive.zip', '/extract/to/directory');
// Clean up archive
$this->cleanUp('/path/to/archive.zip');
// Rename skeleton files to package-specific names
$this->renameFiles();
// Remove rule files
$this->cleanUpRules();
}
}
```
--------------------------------
### Clone Laravel Package with Git History
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Clones an existing Laravel package from a GitHub repository using `git clone`, preserving the full Git history. This is useful for active development on forked packages. Supports specifying branches and overriding vendor/package detection.
```bash
php artisan packager:git https://github.com/author/repository
php artisan packager:git https://github.com/author/repository --branch=develop
php artisan packager:git https://github.com/author/repository my-vendor my-package
```
--------------------------------
### Clone Package with Specific Branch and Name
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Clones a package's Git repository, specifying a branch and overriding the default vendor/package name. This offers fine-grained control over the cloning process.
```bash
php artisan packager:git https://github.com/author/repository my-vendor my-package
```
--------------------------------
### Publish Package Tests using Laravel Packager
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Copies package tests to the Laravel application's test directory for integrated testing. It can publish tests for all packages or a specific one, preserving the directory structure.
```bash
# Publish tests for all packages
php artisan packager:tests
# Publish tests for specific package
php artisan packager:tests my-vendor my-package
```
--------------------------------
### Configure PHPUnit for Package Tests
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
This XML configuration snippet shows how to add a testsuite to `phpunit.xml` to include tests located in the `./tests/packages` directory, typically used after publishing package tests.
```xml
./tests/packages
```
--------------------------------
### Configure PHPUnit for Package Tests
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Adds a new testsuite configuration to `phpunit.xml` to include tests located in the `./tests/packages` directory. This allows PHPUnit to discover and run tests from published packages.
```xml
./tests/packages
```
--------------------------------
### Environment Variable for SSL Verification (Env)
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
This environment variable, `CURL_VERIFY`, is used to control SSL certificate verification for cURL requests made by the Laravel Packager. Setting it to `false` can resolve issues, particularly on Windows environments, where SSL verification might cause problems.
```env
# Disable SSL verification (Windows workaround)
CURL_VERIFY=false
```
--------------------------------
### Register Packager Service Provider (Manual)
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Manually registers the Packager Service Provider in the application's config/app.php file. This is required for Laravel versions prior to 5.5.
```php
JeroenG\Packager\PackagerServiceProvider::class,
```
--------------------------------
### Register Packager Service Provider via Composer Extra (JSON)
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
This JSON configuration snippet shows how to register the `JeroenG\Packager\PackagerServiceProvider` automatically using the `extra` section in a `composer.json` file. This is the standard method for auto-discovery in Laravel 5.5 and later.
```json
{
"extra": {
"laravel": {
"providers": [
"JeroenG\Packager\PackagerServiceProvider"
]
}
}
}
```
--------------------------------
### Configure Timeout Setting
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Adjusts the timeout configuration for creating new packages. This can be modified in the config/packager.php file to resolve timeout issues.
```php
// In config/packager.php
'timeout' => 60 // Example: set timeout to 60 seconds
```
--------------------------------
### Remove Package using Laravel Packager
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Removes a package by running composer remove, updating composer.json, and deleting the package directory. It includes safety features like warnings for non-empty vendor directories and confirmation prompts.
```bash
php artisan packager:remove my-vendor/my-package
```
--------------------------------
### Remove Package Command
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Removes a specified package and its references from composer.json and config/app.php. This command is executed via Artisan.
```bash
php artisan packager:remove my-vendor my-package
```
--------------------------------
### Conditionally Register Packager Service Provider in Development (PHP)
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
This PHP code snippet shows how to register the `JeroenG\Packager\PackagerServiceProvider` only when the application environment is set to 'local'. This is achieved within the `register` method of `app/Providers/AppServiceProvider.php`, allowing the package to be loaded exclusively during development.
```php
// app/Providers/AppServiceProvider.php
public function register()
{
if ($this->app->environment('local')) {
$this->app->register('JeroenG\Packager\PackagerServiceProvider');
}
}
```
--------------------------------
### Disable Package Service Provider using Laravel Packager
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
Disables a package by removing its service provider from the `config/app.php` file. This command safely removes the provider entry while preserving other configurations in the file.
```bash
php artisan packager:disable my-vendor my-package
```
--------------------------------
### Manually Register Packager Service Provider in Laravel App (PHP)
Source: https://context7.com/jeroen-g/laravel-packager/llms.txt
This PHP code demonstrates how to manually register the `JeroenG\Packager\PackagerServiceProvider` in the `config/app.php` file. This method is used for Laravel versions 5.4 and below, where auto-discovery is not available.
```php
'providers' => [
// Other providers...
JeroenG\Packager\PackagerServiceProvider::class,
],
```
--------------------------------
### Register Service Provider Conditionally (Local Environment)
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Registers the Packager Service Provider only in the local development environment to avoid it loading in production. This is an alternative to disabling package auto-discovery.
```php
if ($this->app->environment('local')) {
$this->app->register('JeroenG\Packager\PackagerServiceProvider');
}
```
--------------------------------
### Disable cURL SSL Verification
Source: https://github.com/jeroen-g/laravel-packager/blob/master/readme.md
Disables SSL certificate verification for cURL requests by setting the CURL_VERIFY environment variable to false in the .env file. This can resolve download issues, especially on Windows, but reduces security.
```dotenv
CURL_VERIFY=false
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.