From 53a32aee054a79630c30b664461654e61e2ef43a Mon Sep 17 00:00:00 2001 From: shivendra-webkul Date: Thu, 10 Oct 2024 13:42:18 +0530 Subject: [PATCH 1/2] Update cods. --- docs/2.0/packages/create-package.md | 59 ++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/docs/2.0/packages/create-package.md b/docs/2.0/packages/create-package.md index 751a313..11ede2f 100644 --- a/docs/2.0/packages/create-package.md +++ b/docs/2.0/packages/create-package.md @@ -77,6 +77,63 @@ return [ ]; ``` +### Registering Your Package Using CLI + +#### Step 1: Verify the `composer.json` File + +Before proceeding, ensure that your package has a valid `composer.json` file. This file defines your package's configuration and dependencies. Below is an example of what the `composer.json` file for `krayin/laravel-admin` should look like: + +```json +{ + "name": "krayin/laravel-admin", + "license": "MIT", + "authors": [ + { + "name": "Example", + "email": "admin@example.com" + } + ], + "autoload": { + "psr-4": { + "Webkul\\Admin\\": "src/" + } + }, + "extra": { + "laravel": { + "providers": [ + "Webkul\\Admin\\Providers\\AdminServiceProvider" + ], + "aliases": {} + } + }, + "minimum-stability": "dev" +} +``` + +#### Key Elements of the `composer.json` File + +- **Package Name:** `"krayin/laravel-admin"` – The name of the package to be installed. +- **License:** `"MIT"` – Defines the license for the package. +- **Authors:** Information about the package authors, such as name and email. +- **Autoloading:** + - `"psr-4"` autoloading is used to map the `Webkul\Admin` namespace to the `src/` directory. +- **Providers:** The `AdminServiceProvider` is listed as a provider to be registered with Laravel automatically. +- **Minimum Stability:** Set to `"dev"` to allow development versions of the package to be installed. + +--- + +#### Step 2: Install the Package Locally + +Once the `composer.json` file is set up, you can install the package locally via Composer's command-line interface. + +Run the following command: + +```bash +composer require krayin/laravel-admin dev-master +``` + +This command tells Composer to require the `krayin/laravel-admin` package and install it along with any other dependencies listed in the package's `composer.json`. + ### Run the Commands Run the following commands to autoload your package and publish its assets and configurations: @@ -202,4 +259,4 @@ Run the following command to autoload your package: composer dump-autoload ``` -Your package is now ready to use ! +Your package is now ready to use ! \ No newline at end of file From 1792429d0f1db06a1cf2cc107f87f2beae982928 Mon Sep 17 00:00:00 2001 From: shivendra-webkul Date: Thu, 10 Oct 2024 13:43:33 +0530 Subject: [PATCH 2/2] Minor changes. --- docs/2.0/packages/create-package.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/2.0/packages/create-package.md b/docs/2.0/packages/create-package.md index 11ede2f..7b1a743 100644 --- a/docs/2.0/packages/create-package.md +++ b/docs/2.0/packages/create-package.md @@ -120,8 +120,6 @@ Before proceeding, ensure that your package has a valid `composer.json` file. Th - **Providers:** The `AdminServiceProvider` is listed as a provider to be registered with Laravel automatically. - **Minimum Stability:** Set to `"dev"` to allow development versions of the package to be installed. ---- - #### Step 2: Install the Package Locally Once the `composer.json` file is set up, you can install the package locally via Composer's command-line interface.