Download the PHP package ehime/hello-world without Composer

On this page you can find all versions of the php package ehime/hello-world. 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 hello-world

Creating your first Composer/Packagist package

Hi everybody! Today I'll write about how you can contribute with PHP community creating packages (or updating your's) using Composer and Packagist.

Using Composer

Composer is a package manager for PHP. You can use packages the community developed and you can contribute with your packages too. Here I'll show how to create a project/package, install Composer inside it and send to Packagist, where others developers can use it inside their projects.

Creating the Package

You can create a new project or update one to use Composer. I'll create a hello world class. It's a simple class but you can create complex projects and share them with the others developers. I'll use "hello-world" as project's name. Composer work in "vendor/package" name format. Here we can set as "vendor" name my name: "ehime" and as package name "hello-world", the name of the project.

Files Structure

You can put all files inside the main dir, but I strongly recommend to create another dir, as "src" to be easier to understand and maintain your code organized. The project structure will start with the follow: hello-world (root dir) src HelloWorld SayHello.php Our SayHello.php file will have:

Starting Composer

As our project is ready we can "install" Composer inside it. This is only create a "composer.json" file inside root dir, but Composer can do that for you. Inside your project root: composer init You'll have the follow Composer response:

What we did here is add information about PHP 5.3 as minimum requirements (require section) and tell Composer to "autoload" (using PSR-0) all files with "HelloWorld" namespace that are inside "src" dir.

Testing Package

Sure we want to do a simple test to verify if our class is working well. You can create a new project and "paste" your classes inside it or test inside your own project, which is better and easier. We're creating a Composer project so we must have Composer files installed inside our projects. So, install it running "composer install" inside your root dir:

composer install

As you have only "php >=5.3.0" inside "composer.json", Composer will install only it's own files. With Composer installed create a directory "tests" inside your root dir. Create the "TestCase.php" file inside it with the follow content:

Go to the terminal (or create a PHP web server inside "tests" dir) and type:

php -f tests/HelloWorld/Tests/TestCase.php

You'll get "Hello World, Composer!". It's working now.

Sending to Packagist.org

Now your project is working and you want to send it to Packagist. The easy way is push your project to Github using Git. Go to Github and create a new public repo called "composer-helloworld", start the Git project inside your root dir and push it:

Now you have your project inside a Github repo and you're ready to send it to Packagist. Go to Packagist web site, create your account, login and Submit a Package. Packagist'll ask you for Repository URL (Git/Svn/Hg). Paste there [email protected]:username/hello-world.git and click "Check!". Packagist will check your project and return the project name. If it's correct accept it.

Packagist Details

Every time you do a new commit to Github you must update the Packagist. Go to your account, your package and click "Force Update!". Packagist will go to Github and update the sources. You can turn on "auto update" going to your Github repo, clicking "Settings", after "Service Hooks" and click the "Packagist" service. There update with your information, like:

From here on out you can now embed this project into another workflow by using the following command.

composer require ehime/hello-world

Our first Composer package is finished, but you can do much more using it. Thanks!

NOTE

If at any time you change your repository url you will sever the Packagist connection and will no longer be able to run autoupdate!


All versions of hello-world with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
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 ehime/hello-world contains the following files

Loading the files please wait ....