-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fd8126
commit 53a32ae
Showing
1 changed file
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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": "[email protected]" | ||
} | ||
], | ||
"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 ! |