Download the PHP package jrean/blogit without Composer

On this page you can find all versions of the php package jrean/blogit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package blogit

jrean/blogit

jrean/blogit is a PHP wrapper for the Github API (not yet Framework Agnostic) built for Laravel/Lumen to publish easily your content and "Blog with Git".

Goals

Installation

This project can be installed via Composer To get the latest version of Blogit, simply add the following line to the require block of your composer.json file:

"jrean/blogit": "~0.1.0"
// or
"jrean/blogit": "dev-master"

You'll then need to run composer install or composer update to download it and have the autoloader updated.

Add the Service Provider

Once Blogit is installed, you need to register the service provider.

Laravel

Open up config/app.php and add the following to the providers key:

Lumen

Open up bootstrap/app.php and add the following:

Enable Dotenv File (Lumen only)

Uncomment the following line in bootstrap/app.php:

// Dotenv::load(__DIR__.'/../');

Configuration

Update your .env file with the following keys and assign your values:

GITHUB_USER                    =your_github_user_name
GITHUB_TOKEN                   =your_github_token
GITHUB_REPOSITORY              =your_repository_name
GITHUB_ARTICLES_DIRECTORY_PATH =content_root_directory_name

Your Github username.

Visit Github and create a Personal Access Tokens

Create a new Public repository or use an existing one.

Inside your repository create a directory (for instance articles) where you will push your files.

Basic usage

Without Controller

Update app/Http/routes.php:

$app->get('/blogit', function() use($app) {

    // Jrean\Blogit\Blogit instance
    $blogit   = $app->make('blogit');

    // Jrean\Blogit\BlogitCollection
    $articles = $blogit->getArticles();

    // Last 3 created Articles
    $news     = $articles->sortByCreatedAtDesc()->take(3);

    // Last 3 updated Articles
    $updates  = $articles->sortByUpdatedAtDesc()->take(3);

    return view('blogit.index', compact('news', 'updates')); });

$app->get('/blogit/{slug}', function($slug) use($app) {

    // Jrean\Blogit\Blogit instance
    $blogit  = $app->make('blogit');

    // Jrean\Blogit\Document\Article
    $article = $blogit->getArticleBySlug($slug);

    if ($article === null) abort(404);

    return view('blogit.show', compact('article'));
});

With Controller

Update app/Http/routes.php:

$app->get('/', [
    'uses' => 'App\Http\Controllers\YourController@index',
    'as'   => 'index'
]);

$app->get('/{slug}', [
    'uses' => 'App\Http\Controllers\YourController@show',
    'as'   => 'show'
]);

Update app/Http/Controllers/YourController.php:

<?php
namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Jrean\Blogit\Repository\DocumentRepositoryInterface;

class YourController extends Controller {

    private $blogit;

    public function __construct(DocumentRepositoryInterface $blogit)
    {
        $this->blogit = $blogit;
    }

    public function index()
    {
        $articles = $this->blogit->getArticles();
        $news     = $articles->sortByCreatedAtDesc()->take(3);
        $updates  = $articles->sortByUpdatedAtDesc()->take(3);

        return view('blogit.index', compact('news', 'updates'));
    }

    public function show($slug)
    {
        $article = $this->blogit->getArticleBySlug($slug);

        if ($article === null) abort(404);

        return view('blogit.show', compact('article'));
    }
}

Views (Blade for instance)

@foreach($articles as $article)
    {{ $article->getTitle() }}
    {{ $article->getSlug() }}
    {{ $article->getLastCommitUrl() }}
    {{ $article->getUpdatedAtDiff() }}
    {{ $article->getTags() }}
    {{ $article->getHtml() }}
    {{ $article->getContributors() }}
    ...
@endforeach

Basic File Format

I recommand to stick with .md files:

title: My Article Title
slug: my-custom-slug
tags: [tag, tag, tag]
---
## My Markdown Content

The .md file contains two sections separated by a delimiter string. One section for the metadata and one for the content.

Delimiter String

To separate metadata and content you MUST use a minimum of three ---. You can use more if you want.

Metadata

Metada will be parsed as Yaml so feel free and creative because you'll access them through an array. The only required key is the title. slug and tags are optionnals. If you don't provide a custom slug, one will be auto generated based on the title value...

Content

Everything under --- will be parsed as Markdown. Again, fell free and creative.

Extending and Customize Blogit

I try and will try my best to give you the ability to extend and override Blogit. For now you can easily hack and extend Jrean\Blogit\Blogit.php and Jrean\Blogit\BlogitCollection.php to bring your own logic, methods and attributes.

Be Creative

With the Blogit API you have access to methods and properties about your content, metadata, commits, contributors, tags, dates, Github links,... Have a look at Jrean\Blogit\Document\*, Jrean\Blogit\Repository\* and Jrean\Blogit\Blogit.php.

Contribute

This package is (yet) under active development and refactoring. Please, feel free to comment, contribute and help. I would like/love to bring Unit tests.

Example

I will write soon a dedicated article for Blogit which is now used on Production for Askjong.com

License

Blogit is licensed under The MIT License (MIT).


All versions of blogit with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
illuminate/support Version 5.0.*|5.1.*|5.2.*
knplabs/github-api Version ~1.4
erusev/parsedown-extra Version ^0.7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jrean/blogit contains the following files

Loading the files please wait ....