Skip to content

Commit f56496e

Browse files
Updated readme
1 parent 7c4af23 commit f56496e

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,46 @@
11
# php-stub-generator
22
A tool to generate stub-files for your php classes.
3+
4+
The main purpose for this tool is to generate stub-files from php classes to have code
5+
completion for your IDE when encrypting your library with e.g.
6+
[the ioncube encoder](http://www.ioncube.com/php_encoder.php).
7+
8+
[![Build Status](https://travis-ci.org/Setasign/php-stub-generator.svg?branch=master)](https://travis-ci.org/Setasign/php-stub-generator)
9+
[![Total Downloads](https://poser.pugx.org/setasign/php-stub-generator/downloads.svg)](https://packagist.org/packages/setasign/php-stub-generator)
10+
[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg)](https://php.net/)
11+
[![License](https://img.shields.io/packagist/l/setasign/php-stub-generator.svg)](https://packagist.org/packages/setasign/php-stub-generator)
12+
13+
## Installation
14+
15+
A basic installation via Composer could be done this way:
16+
17+
```bash
18+
$ composer require setasign/php-stub-generator
19+
```
20+
21+
Composer will install the library to your project's `vendor/setasign/php-stub-generator` directory.
22+
23+
24+
## Basic usage
25+
26+
```php
27+
<?php
28+
29+
use setasign\PhpStubGenerator\PhpStubGenerator;
30+
use setasign\PhpStubGenerator\Reader\AllFiles;
31+
32+
require_once __DIR__ . '/vendor/autoload.php';
33+
34+
$generator = new PhpStubGenerator();
35+
$generator->addSource(
36+
'setapdf-core',
37+
new AllFiles(__DIR__ . '/vendor/setasign/setapdf-core/library')
38+
);
39+
$output = $generator->generate();
40+
41+
file_put_contents(__DIR__ . '/setapdf-core-stub.php', $output);
42+
```
43+
44+
## TODO
45+
- Traits are not supported yet
46+
- Command line tool: bin/generate-stub vendor/setasign/setapdf-core/library setapdf-core-stub.php

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"license": "MIT",
66
"authors": [
77
{
8-
"name": "bob4ever"
8+
"name": "Maximilian Kresse",
9+
"email": "maximilian.kresse@setasign.com"
910
}
1011
],
1112

tests/bootstrap.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
ini_set('display_errors', 1);
33

44
if (defined("AUTOLOAD_PATH")) {
5-
if (is_file(__DIR__ . '/../' .AUTOLOAD_PATH)) {
6-
$loader = include_once __DIR__ . '/../' . AUTOLOAD_PATH;
5+
if (is_file(__DIR__ . '/../' . AUTOLOAD_PATH)) {
6+
include_once __DIR__ . '/../' . AUTOLOAD_PATH;
77
} else {
8-
throw new InvalidArgumentException("Cannot load custom autoload file located at ".AUTOLOAD_PATH);
8+
throw new InvalidArgumentException(sprintf(
9+
'Can\'t load custom autoload file located at %s',
10+
AUTOLOAD_PATH
11+
));
912
}
1013
}

0 commit comments

Comments
 (0)