Skip to content

Commit 564848c

Browse files
Merge pull request #29 from shivendra-webkul/update-docs
Update cods.
2 parents aff0a7f + 1792429 commit 564848c

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

docs/2.0/packages/create-package.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,61 @@ return [
7777
];
7878
```
7979

80+
### Registering Your Package Using CLI
81+
82+
#### Step 1: Verify the `composer.json` File
83+
84+
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:
85+
86+
```json
87+
{
88+
"name": "krayin/laravel-admin",
89+
"license": "MIT",
90+
"authors": [
91+
{
92+
"name": "Example",
93+
"email": "[email protected]"
94+
}
95+
],
96+
"autoload": {
97+
"psr-4": {
98+
"Webkul\\Admin\\": "src/"
99+
}
100+
},
101+
"extra": {
102+
"laravel": {
103+
"providers": [
104+
"Webkul\\Admin\\Providers\\AdminServiceProvider"
105+
],
106+
"aliases": {}
107+
}
108+
},
109+
"minimum-stability": "dev"
110+
}
111+
```
112+
113+
#### Key Elements of the `composer.json` File
114+
115+
- **Package Name:** `"krayin/laravel-admin"` – The name of the package to be installed.
116+
- **License:** `"MIT"` – Defines the license for the package.
117+
- **Authors:** Information about the package authors, such as name and email.
118+
- **Autoloading:**
119+
- `"psr-4"` autoloading is used to map the `Webkul\Admin` namespace to the `src/` directory.
120+
- **Providers:** The `AdminServiceProvider` is listed as a provider to be registered with Laravel automatically.
121+
- **Minimum Stability:** Set to `"dev"` to allow development versions of the package to be installed.
122+
123+
#### Step 2: Install the Package Locally
124+
125+
Once the `composer.json` file is set up, you can install the package locally via Composer's command-line interface.
126+
127+
Run the following command:
128+
129+
```bash
130+
composer require krayin/laravel-admin dev-master
131+
```
132+
133+
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`.
134+
80135
### Run the Commands
81136
82137
Run the following commands to autoload your package and publish its assets and configurations:
@@ -202,4 +257,4 @@ Run the following command to autoload your package:
202257
composer dump-autoload
203258
```
204259

205-
Your package is now ready to use !
260+
Your package is now ready to use !

0 commit comments

Comments
 (0)