Lravel5 Study Five: Publish your own composer package on Packagist

Source: Internet
Author: User

Learning Laravel5 has been a period of time, deeply composer the function of the management PHP package moved, think oneself also to write a package, released to Packagist on.

Package Function Introduction

This package implements the function: Laravel5 uses the Baidu Ueditor editor, simultaneously supports uploads the file to seven cattle and the local.
This project original author project address: Stevenyangecho/laravel-u-editor

I revise some of the instructions:

    • Modified the upload picture echo path is incorrect for projects that are not deployed to the root directory
    • Name the configuration file: ueditor.php, add the variable baseurl in it, and a description of the partial variable
    • Added local and Qiniu constants
    • Added constraint to FileInfo extension in composer
    • Added a new ifram.css style to the editor to make the editor content adaptive to size
Publish to Packagist

This process is the focus of this blog post.

First of all, to publish a written project to Packagist, you need to post the project on GitHub (which is more than one option, but I love it), release the project to GitHub I won't say, after the project was released successfully,
1. Login to Packagist, click Submit , then fill in the project address on GitHub and click Check

2. If your composer.json is not a problem and the project does not exist at Packagist, then congratulations, you can publish your first composer package. , click Submit to

3. This will jump to a page asking you to set up a GitHub Service Hook, the main function of this thing is when you modify the project, submitted to GitHub, the project on the packagist can automatically get the latest code, reducing the time you have to manually update.

Notice the Red box section here, which shows "No Automatic Updates"

set up Automatic Updates for packages

For how to set up automatic package updates, an official document is written very well, here is a diagram to illustrate the whole process:
1. Open the Project address page on your github and click [Settings] on the right.

2. Select [Wbehooks & Services] and configure the services


3. Now is the configuration, configuration details, here is a bit to illustrate, here is a API token, this token is provided by Packagist, in your project inside, you can see.
API Token acquisition

Configuration on GitHub

It's done. Click on the bottom "add service",
4. Go to the service you just configured, at the top you can see a [Test Service] button, click on it, see the following effect

Then, go back to your project page in Packagist, refresh it, and you'll see the following:

Notice the contents of the red box here, the first time we have not configured, the display of a line of green word Not Auto-Updated , now it disappears, which means that we set the success.

Now that you can modify your project and then check the package on the packagist, you will find that the automatic update is implemented, and the configuration is complete.

Note

Improved Project address: Laravel-ueditor
Welcome everyone start

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Lravel5 Study Five: Publish your own composer package on Packagist

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.