Skip to content
This repository has been archived by the owner on Jan 3, 2020. It is now read-only.

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Faust committed Nov 4, 2016
0 parents commit 07310ae
Show file tree
Hide file tree
Showing 14 changed files with 322 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* text=auto

/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
composer.lock
phpunit.xml
vendor
3 changes: 3 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
preset: laravel

linting: true
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- hhvm

sudo: false

before_script:
- travis_retry composer self-update
- travis_retry composer update --no-interaction --prefer-source

script:
- if [ "$TRAVIS_PHP_VERSION" != "5.6" ]; then vendor/bin/phpunit; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi

after_script:
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi

20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2016 Brian Faust <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Laravel Parsedown

## Installation

Require this package, with [Composer](https://getcomposer.org/), in the root directory of your project.

``` bash
$ composer require faustbrian/laravel-parsedown
```

Add the service provider to `config/app.php` in the `providers` array.

``` php
'providers' => [
// ... Illuminate Providers
// ... App Providers
BrianFaust\Parsedown\ServiceProvider::class
];
```

If you want you can use the [facade](http://laravel.com/docs/facades). Add the reference in `config/app.php` to your aliases array.

``` php
'aliases' => [
// ... Illuminate Facades
'Markdown' => BrianFaust\Parsedown\Facades\Parsedown::class
];
```

## Usage

``` php
Markdown::text('Hello _Parsedown_!') # <p>Hello <em>Parsedown</em>!</p>
```

## Security

If you discover a security vulnerability within this package, please send an e-mail to Brian Faust at [email protected]. All security vulnerabilities will be promptly addressed.

## License

The [The MIT License (MIT)](LICENSE). Please check the [LICENSE](LICENSE) file for more details.
44 changes: 44 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "faustbrian/laravel-parsedown",
"description": "Parsedown Wrapper for Laravel 5",
"keywords": ["laravel", "framework", "Laravel-Parsedown", "Laravel Parsedown", "Brian Faust", "faustbrian"],
"license": "MIT",
"authors": [{
"name": "Brian Faust",
"email": "[email protected]",
"homepage": "https://brianfaust.de",
"role": "Developer"
}],
"require": {
"php": "^5.6 || ^7.0",
"illuminate/support": "5.1.* || 5.2.* || 5.3.*",
"erusev/parsedown": "^1.6"
},
"require-dev": {
"graham-campbell/testbench": "^3.1",
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.0",
"scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "~2.3"
},
"autoload": {
"psr-4": {
"BrianFaust\\Parsedown\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"BrianFaust\\Tests\\Parsedown\\": "tests"
}
},
"config": {
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
28 changes: 28 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Laravel Parsedown Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
19 changes: 19 additions & 0 deletions src/Facades/Parsedown.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace BrianFaust\Parsedown\Facades;

use Illuminate\Support\Facades\Facade;

/**
* Class Parsedown.
*/
class Parsedown extends Facade
{
/**
* @return string
*/
protected static function getFacadeAccessor()
{
return 'parsedown';
}
}
32 changes: 32 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace BrianFaust\Parsedown;

use Illuminate\Support\ServiceProvider as IlluminateProvider;
use Parsedown;

/**
* Class ServiceProvider.
*/
class ServiceProvider extends IlluminateProvider
{
/**
* Register the application services.
*/
public function register()
{
$this->app->singleton('parsedown', function ($app) {
return new Parsedown();
});
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['parsedown'];
}
}
21 changes: 21 additions & 0 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace BrianFaust\Tests\Parsedown;

use GrahamCampbell\TestBench\AbstractPackageTestCase;
use BrianFaust\Parsedown\ServiceProvider;

abstract class AbstractTestCase extends AbstractPackageTestCase
{
/**
* Get the service provider class.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return string
*/
protected function getServiceProviderClass($app)
{
return ServiceProvider::class;
}
}
50 changes: 50 additions & 0 deletions tests/Facades/ParsedownTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace BrianFaust\Tests\Parsedown\Facades;

use BrianFaust\Parsedown\Facades\Parsedown as Markdown;
use BrianFaust\Tests\Parsedown\AbstractTestCase;
use GrahamCampbell\TestBenchCore\FacadeTrait;
use Parsedown;

class ParsedownTest extends AbstractTestCase
{
use FacadeTrait;

/**
* Get the facade accessor.
*
* @return string
*/
protected function getFacadeAccessor()
{
return 'parsedown';
}

/**
* Get the facade class.
*
* @return string
*/
protected function getFacadeClass()
{
return Markdown::class;
}

/**
* Get the facade root.
*
* @return string
*/
protected function getFacadeRoot()
{
return Parsedown::class;
}

public function testConvertToHtml()
{
$result = Markdown::text('Hello _Parsedown_!');

$this->assertSame('<p>Hello <em>Parsedown</em>!</p>', $result);
}
}
10 changes: 10 additions & 0 deletions tests/ServiceProviderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace BrianFaust\Tests\Parsedown;

use GrahamCampbell\TestBenchCore\ServiceProviderTrait;

class ServiceProviderTest extends AbstractTestCase
{
use ServiceProviderTrait;
}

0 comments on commit 07310ae

Please sign in to comment.