2017 © Pedro Peláez
 

library my_first_library

This is my very first library created with composer init

image

conquerorsoft/my_first_library

This is my very first library created with composer init

  • Saturday, November 11, 2017
  • by gabriel0702
  • Repository
  • 1 Watchers
  • 1 Stars
  • 60 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

My First Library

![Build Status][ico-travis] Software License Coverage Status ![Quality Score][ico-code-quality] Latest Version on Packagist, (*1)

This is my very first library I created at php[world]. I learned that I have to create a README file to provide a description of my library so it can be used by other projects or persons., (*2)

The steps to create "my first library"

1- create the my_first_library directory, (*3)

cd ~ && mkdir -p phplibrary/my_first_library && cd phplibrary/my_first_library

2- create a README.md file, (*4)

vim README.md

3- initialize a git repository, (*5)

git init

4- Do the first commit, (*6)

git add .
git commit -m "First commit of my library"

5- Assign a version to your library, (*7)

git tag -a v0.1.0 -m "version 0.1.0"

6- Create a repository in github or bitbucket 7- Connect your repository with github (or bitbucket), (*8)

git remote add origin https://github.com/ConquerorSoft/my_first_library.git
git push -u origin master
git push origin v0.1.0

8- run composer init, (*9)

composer init

9- enter all the information asked by composer init, (*10)

Package name (<vendor>/<name>) [gabriel/my_first_library]: conquerorsoft/my_first_library
Description []: This is my very first library created with composer init
Author [Christian Varela <dobleclick.mx@gmail.com>, n to skip]: Christian Varela <cvarela@conquerorsoft.com>
Minimum Stability []: stable
Package Type (e.g. library, project, metapackage, composer-plugin) []: library
License []: MIT

Define your dependencies.

Would you like to define your dependencies (require) interactively [yes]? no
Would you like to define your dev dependencies (require-dev) interactively [yes]?
Search for a package: phpunit

Found 15 packages matching phpunit

   [0] phpunit/phpunit
   [1] mockery/mockery
   [2] phpunit/phpunit-mock-objects
   [3] phpunit/php-timer
   [4] phpunit/php-code-coverage
   [5] phpunit/phpunit-selenium
   [6] brianium/paratest
   [7] phpunit/php-token-stream
   [8] phpunit/php-text-template
   [9] phpunit/php-file-iterator
  [10] mybuilder/phpunit-accelerator
  [11] johnkary/phpunit-speedtrap
  [12] symfony/phpunit-bridge
  [13] nette/tester
  [14] gecko-packages/gecko-php-unit

Enter package # to add, or the complete package name if it is not listed: 0
Enter the version constraint to require (or leave blank to use the latest version): ^5.7
Using version ^5.7 for phpunit/phpunit
Search for a package:

{
    "name": "conquerorsoft/my_first_library",
    "description": "This is my very first library created with composer init",
    "type": "library",
    "require-dev": {
        "phpunit/phpunit": "^5.7"
    },
    "license": "MIT",
    "authors": [
        {
            "name": "Christian Varela",
            "email": "cvarela@conquerorsoft.com"
        }
    ],
    "minimum-stability": "stable",
    "require": {}
}

Do you confirm generation [yes]?
Would you like the vendor directory added to your .gitignore [yes]?

10- composer.json file is created, commit to git, (*11)

git add .
git commit -m "Composer init"
git tag -a v0.1.1 -m "version 0.1.1"
git push -u origin master
git push origin v0.1.1

11- Run composer install, (*12)

composer install

12- Add composer.lock to .gitignore, (*13)

echo "composer.lock" >> .gitignore

13- create a Changelog file ( this format is recommended: Keep a Changelog ), (*14)

vim CHANGELOG.md

14- commit to git, (*15)

git add .
git commit -m "Changelog file added"
git tag -a v0.1.2 -m "version 0.1.2"
git push -u origin master
git push origin v0.1.2

15- Create structure for starting the development, (*16)

mkdir src && mkdir tests

16- Edit the composer.json file to be this way now:, (*17)

{
    "name": "conquerorsoft/my_first_library",
    "description": "This is my very first library created with composer init",
    "keywords": [
        "conquerorsoft",
        "my_first_library",
        "tutorial",
        "phpworld 2017",
        "workshop"
    ],
    "homepage": "http://www.conquerorsoft.com/my_first_library",
    "type": "library",
    "require-dev": {
        "phpunit/phpunit": "^5.7",
        "squizlabs/php_codesniffer": "3.*"
    },
    "license": "MIT",
    "authors": [
        {
            "name": "Christian Varela",
            "email": "cvarela@conquerorsoft.com",
            "homepage": "http://www.conquerorsoft.com/ChristianVarela",
            "role": "Developer"
        }
    ],
    "minimum-stability": "stable",
    "require": {
        "php": "~5.6 || ~7.0"
    },
    "autoload": {
        "psr-4": {
            "conquerorsoft\\my_first_library\\": "src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "conquerorsoft\\my_first_library\\": "tests"
        }
    },
    "scripts": {
        "test": "phpunit",
        "check-style": "phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests",
        "fix-style": "phpcbf -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests"
    }
}

17- Create file phpunit.xml, (*18)

vim phpunit.xml

18- add build to .gitignore, (*19)

echo build >> .gitignore

19- run composer update, (*20)

composer update

20- commit to git, (*21)

git add .
git commit -m "Preparation for development"
git tag -a v0.1.3 -m "version 0.1.3"
git push -u origin master
git push origin v0.1.3

21- Add a LICENSE.md file (for this example we chose MIT), (*22)

vim LICENSE.md

22- Create tests/FirstClassTest.php, (*23)

vim tests/FirstClassTest.php

23- Create src/FirstClass.php, (*24)

vim src/FirstClass.php

24- commit to git, (*25)

git add .
git commit -m "Encode and decode string functionality"
git tag -a v0.1.4 -m "version 0.1.4"
git push -u origin master
git push origin v0.1.4

25- docblock everything including classes, files and functions, (*26)

/**
 * This is a summary example
 *
 * This is a description
 *
 * @example this is tag
 */

26- commit to git, (*27)

git add .
git commit -m "Docblocks added everywhere"
git tag -a v0.1.5 -m "version 0.1.5"
git push -u origin master
git push origin v0.1.5

27- add repository to Travis and create travis configuration file, (*28)

vim .travis.yml

28- commit to git, (*29)

git add .
git commit -m "Travis CI integration"
git tag -a v0.1.6 -m "version 0.1.6"
git push -u origin master
git push origin v0.1.6

29- change composer.json to change phpunit to version ^5.7, (*30)

vim composer.json

30- commit to git, (*31)

git add .
git commit -m "Phpunit version changed to support php version 5.6"
git tag -a v0.1.7 -m "version 0.1.7"
git push -u origin master
git push origin v0.1.7

31- Get travis badge and put it in README file, (*32)

vim README.md

32- Put license badge in README file 33- commit to git, (*33)

git add .
git commit -m "Travis CI and License badges in README"
git tag -a v0.1.8 -m "version 0.1.8"
git push -u origin master
git push origin v0.1.8

34- Create scrutinizer-ci account and link with github 35- Create .scrutinizer.yml file, (*34)

vim .scrutinizer.yml

36- Get scrutinizer badges in README file, (*35)

vim README.md

37- commit to git, (*36)

git add .
git commit -m "Scrutinizer CI and badges in README"
git tag -a v0.1.9 -m "version 0.1.9"
git push -u origin master
git push origin v0.1.9

38- Remove type hinting that is not compatible with php 5.6, (*37)

vim FirstClass.php

39- commit to git, (*38)

git add .
git commit -m "Fixes to uncompatible type hinting"
git tag -a v0.1.10 -m "version 0.1.10"
git push -u origin master
git push origin v0.1.10

40- apply patch from scrutinizer 41- commit to git, (*39)

git add .
git commit -m "Spacing patch from scrutinizer applied"
git tag -a v0.1.11 -m "version 0.1.11"
git push -u origin master
git push origin v0.1.11

42- Create Contributing files, (*40)

vim CONTRIBUTING.md
vim CODE_OF_CONDUCT.md

43- Add more sections to README file, (*41)

  • Install
  • Usage
  • Change log
  • Testing
  • Contributing
  • Security
  • Credits
  • License

44- commit to git, (*42)

git add .
git commit -m "Improvements to README"
git tag -a v0.1.12 -m "version 0.1.12"
git push -u origin master
git push origin v0.1.12

45- Add .gitattributes file to ignore some files or folders when --prefer-dist is used, (*43)

vim .gitattributes

46- commit to git, (*44)

git add .
git commit -m ".gitattributes file created"
git tag -a v0.1.13 -m "version 0.1.13"
git push -u origin master
git push origin v0.1.13

47- create an account in packagist.org and submit your library using your github repository 48- Make your package in packagist to be autoupdated on push - Go to your GitHub repository - Click the "Settings" button - Click "Integrations & services" - Add a "Packagist" service, and configure it with your API token, plus your Packagist username - Check the "Active" box and submit the form, (*45)

49- Add last version in packagist badge to README.md file, (*46)

vim README.md

50- commit to git, (*47)

git add .
git commit -m "Instructions to use packagist.org in README"
git tag -a v0.1.14 -m "version 0.1.14"
git push -u origin master
git push origin v0.1.14

51- Create a gh-pages branch, (*48)

git checkout -b gh-pages
git push -u origin gh-pages
git checkout master

52- Go to github settings for your repository 53- Choose a theme in GitHub Pages section 54- Your library page is ready now: https://conquerorsoft.github.io/my_first_library/ 55- commit to git and increase version, (*49)

git add .
git commit -m "Documentation instructions for the library"
git tag -a v1.0.0 -m "version 1.0.0"
git push -u origin master
git push origin v1.0.0

Install

With composer, (*50)

composer require conquerorsoft/my_first_library

Usage

$my_first_library = new conquerorsoft\my_first_library\FirstClass();
$encoded_string = $my_first_library->encodeString("Encoding this string");
$decode_string = $my_first_library->decodeString("03wwrwp o0xv v7 or012 y0xsnl2");

Change Log

Please see CHANGELOG for more information on what has changed recently., (*51)

Testing

composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details., (*52)

Security

If you discover any security related issues, please email cvarela@conquerorsoft.com instead of using the issue tracker., (*53)

Credits

License

The MIT License (MIT). Please see License File for more information., (*54)

The Versions

11/11 2017

dev-master

9999999-dev http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

11/11 2017

v1.0.0

1.0.0.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

10/11 2017

v0.1.14

0.1.14.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

10/11 2017

v0.1.13

0.1.13.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

09/11 2017

v0.1.12

0.1.12.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

08/11 2017

v0.1.11

0.1.11.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

08/11 2017

v0.1.10

0.1.10.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

08/11 2017

v0.1.9

0.1.9.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

08/11 2017

v0.1.8

0.1.8.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

07/11 2017

v0.1.7

0.1.7.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

07/11 2017

v0.1.6

0.1.6.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

07/11 2017

v0.1.5

0.1.5.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

06/11 2017

v0.1.4

0.1.4.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

05/11 2017

v0.1.3

0.1.3.0 http://www.conquerorsoft.com/my_first_library

This is my very first library created with composer init

  Sources   Download

MIT

The Requires

  • php ~5.6 || ~7.0

 

The Development Requires

tutorial workshop conquerorsoft my_first_library phpworld 2017

04/11 2017

v0.1.2

0.1.2.0

This is my very first library created with composer init

  Sources   Download

MIT

The Development Requires

04/11 2017

v0.1.1

0.1.1.0

This is my very first library created with composer init

  Sources   Download

MIT

The Development Requires