Download the PHP package nyoncode/laravel-package-toolkit without Composer

On this page you can find all versions of the php package nyoncode/laravel-package-toolkit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-package-toolkit

📦 Laravel package toolkit

Laravel Package toolkit is a powerful tool designed to streamline the process of creating and managing packages for Laravel. It provides a set of intuitive abstractions and helper methods for common package development tasks, enabling developers to focus on building features rather than boilerplate code.

Features

Support Laravel

Table of Contents

Installation

You can install the package via composer:

Usage

Basic Configuration

To use Laravel Package Builder, create a ServiceProvider for your package that extends NyonCode\LaravelPackageToolkit\PackageServiceProvider:

Advanced Configuration

For more control over your package configuration, you can use additional methods and specify custom paths:

Conditional registration resources

You can also use the when() method to conditionally register resources:

Local and production resources will be registered when the isInLocal() and isInProduction() methods return true.

Additional Conditional Methods

The package provides several convenient methods for conditional loading:


Lifecycle Hooks

The package provides lifecycle hooks that allow you to execute custom logic at specific points during package registration and booting:

Hook Method Description
registeringPackage() Called before register() is called
registeredPackage() Called after register() is called
bootingPackage() Called before boot() is called
bootedPackage() Called after boot() is called

Using Lifecycle Hooks in Configuration

You can define lifecycle hooks directly in your package configuration:


Name

Define a name for the package:


Short name

Define a custom short name for the package. The hasShortName method is used to modify the name defined by name() if you prefer not to use the short version from $packager->name('Package name'):

The short name must be in kebab-case format and contain only lowercase letters, numbers, and hyphens.


Config

To enable configuration in your package:


By default, this will load configuration from the config directory. For custom config files:

Or for specific file paths:

To use an alternative directory for config files.


Routing

To enable routing in your package:

By default, this will load routes from the routes directory. For custom route files:

Or for specific file paths:

To use an alternative directory for route files.


Middlewares

To register middleware for your package, use these methods:

Register Middleware Aliases

To define route middleware aliases:

This allows you to assign the middleware to routes using its alias:

Register Middleware Groups

To push middleware into existing middleware groups:

This will automatically add your middleware to the specified groups (e.g. web, api).

Register Middleware Globally

To register global middleware (executed for every request):

This middleware will be added to the middleware stack and is useful for applying middleware to all routes regardless of their group.

Migrations

To enable migrations:

Or for specific file paths:

This loads migrations from the database/migrations directory. For a custom directory:

To use an alternative directory for migration files.

For more information about migrations, see Laravel migrations.

Use migration without publishing

This will load migrations directly when the package is registered, without requiring them to be published first.


Translations

To enable translations:

This loads translations from the lang directory and automatically supports JSON translations.

For a custom directory:

The package automatically validates language directory names against supported language codes and detects JSON translation files.


Commands

To enable commands:

Defaults to loading commands from the Commands directory. To use an alternative directory for command files.

For single command:

Or for specific file names:

For more information about commands, see Laravel commands.


Views

To enable views:

This loads views from the resources/views directory. For a custom directory:

You can also specify a custom views directory with a different path:


View Components

To register multiple view components:

To register a single view component with an optional alias:

You can then use these components in your Blade templates:


View Component Namespaces

To register multiple view component namespaces:

To register a single view component namespace with an optional alias:

You can then use these namespaces in your Blade templates:


View Composers

To register multiple view composers:

You can also bind a composer to all views using the wildcard *:


View Shared Data

To add shared data to views:

This adds key-value pairs to the shared data array in the view. The shared data must have string keys and values must be scalar, array, null, or implement the Arrayable interface.

For more information about shared data, see Laravel shared data.


Assets

To enable assets:

This loads assets from the dist directory by default. For a custom directory:

Assets will be published to public/vendor/{package-short-name} when using the publish command.


Providers

To enable service providers:

Support for multiple service providers:

Service providers will be published to app/Providers/{ProviderName}.php when using the publish command.


Install Command

The package provides a powerful install command system that allows users to easily install and configure your package.

Basic Install Command

To enable the install command:

This creates a command {package-short-name}:install that users can run to install your package.

Configuring the Install Command

You can configure what gets installed using a callback:

Install Command Options

The install command supports several configuration options:

Pre-built Install Configurations

The package provides several pre-built installation configurations:

Advanced Install Command Configuration

For more advanced configurations, you can use the full callback approach:

Available Publishing Methods

The install command supports the following publishing methods:

Conditional Publishing

You can conditionally publish resources:


About Command

Laravel Package Builder provides methods to add package information to Laravel's php artisan about command.

hasAbout()

The hasAbout() method allows you to include your package's information in the Laravel About command. By default, it will include the package's version.

hasVersion()

The hasVersion() method lets you manually set the version of your package:

If no version is manually set, the package will automatically retrieve the version from your composer.json file.

Customizing About Command Data

You can extend the about command information by implementing the aboutData() method in your service provider:

This method allows you to add custom key-value pairs to the About command output for your package. When you run php artisan about, your package's information will be displayed in a dedicated section. This implementation allows for flexible and easy inclusion of package metadata in Laravel's system information command.


Publishing

For publishing, you can use the following commands:

vendor:publish show all the tags that can be used for publishing.

Available Publishing Tags

Each resource type has its own publishing tag in the format {package-short-name}::{resource-type}:

Example of using tags:

Use php artisan vendor:publish --tag=package-short-name::config for publish configuration files.


Testing

The package includes comprehensive tests for all features including:


Versioning

This package follows Semantic Versioning (SemVer).

Given a version number MAJOR.MINOR.PATCH, we increment the:

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

Compatibility Promise

We recommend using version constraints in your composer.json that allow for minor and patch updates but protect against major version changes:


License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-package-toolkit with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-readline Version *
composer/composer Version ^2.8
illuminate/support Version ^9.34|^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nyoncode/laravel-package-toolkit contains the following files

Loading the files please wait ....