An open API service indexing awesome lists of open source software.

https://github.com/sohelamin/package-boilerplate

PHP Package Boilerplate
https://github.com/sohelamin/package-boilerplate

Last synced: 8 months ago
JSON representation

PHP Package Boilerplate

Awesome Lists containing this project

README

          

# Package Boilerplate
PHP Package Boilerplate

## Installation

1. Make your vendor directory under your project's main vendor directory.
```
cd vendor
mkdir my-vendor
```

2. Clone the package's boilerplate from github repo into your vendor's package directory.
```
git clone https://github.com/sohelamin/package-boilerplate.git my-package
cd my-package
```

3. Add your package dir to your project's main **composer.json** file.
```
"psr-4": {
"App\\": "app/",
"MyVendor\\MyPackage\\": "vendor/my-vendor/my-package/src"
}
```
Note: When you will submit your package to **packagist.org** for composer package then you don't need to follow above instruction #3.

4. Navigate to your project directory and run.
```
composer dump-autoload
composer update
```

## Usage

See the bellow snippets.

```php
\MyVendor\MyPackage\MyPackageClass::sayHi();

// OR

use MyVendor\MyPackage;
MyPackageClass::sayHi();
```

##Author

Sohel Amin