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

add a basic composer configuration file #52

Closed
wants to merge 1 commit into from

Conversation

csanquer
Copy link

see #51

to test installation with composer:

add this to your composer.json config file

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/csanquer/PHPExcel.git"
        }
    ],
    "minimum-stability": "dev",
    "require": {
        "phpoffice/phpexcel": "*"
    }
}

then run

php composer.phar update

A class mapping is generated in vendor/composer/autoload_classmap.php and you need only to include the autoloader vendor/autoload.php

@MarkBaker
Copy link
Member

I'm not as familiar with composer as I should be (it's on my "to learn about" list), so I'm not completely sure what this actually does, how it ties (for example) the minimum-stability with a branch or tag on github.

@vinigarcia87
Copy link

You guys should create a Zend Framework 2 Module for PHPExcel too!

@csanquer
Copy link
Author

csanquer commented Oct 2, 2012

@vinigarcia87 Sorry i don't see the connection with composer config

@vinigarcia87
Copy link

ZF2 uses composer and PSR-0 autoload to install vendor modules...

@lsmith77
Copy link

@MarkBaker composer has become more or less the defacto tool for managing dependencies with php. there already seem to be 2 people that have forked this code and created their "own" composer packages:

it would be good to get this from the source.

@tlfbrito
Copy link

@MarkBaker plz check http://www.youtube.com/watch?v=9A4XrB5g0fk&feature=player_embedded to learn more about composer

@cyberwolf
Copy link

If I am correctly reading the code PHPExcel will also register its own autoloader in Classes/PHPExcel.php:

/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/');
    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}

In PHPExcel/Autoloader.php:

PHPExcel_Autoloader::Register();

If PHPExcel will support installation via Composer (+1 from me), is there a way to circumvent loading PHPExcel's own autoloader as well?

@rogeriopradoj
Copy link
Contributor

+1

1 similar comment
@robsonpeixoto
Copy link

+1

@MarkBaker
Copy link
Member

Hopefully composer file now in place, and I'm sure somebody who knows more about these things will correct me if it's wrong

@MarkBaker MarkBaker closed this Nov 23, 2012
@lsmith77
Copy link

thx .. i added some comments for things that need to be fixed.

FYI there is php composer.phar validate to validate the composer.json.
There is then one last step to do and that is to register the package on https://packagist.org

@robsonpeixoto
Copy link

Some suggestion ...

diff --git a/composer.json b/composer.json
index c6ef49c..a547934 100644
--- a/composer.json
+++ b/composer.json
@@ -4,7 +4,7 @@
     "keywords": ["PHP","Excel","OpenXML","xlsx","xls","spreadsheet"],
     "homepage": "http://phpexcel.codeplex.com",
     "type": "library",
-    "license": "LGPL",
+    "license": "LGPL-2.1",
     "authors": [
         {
             "name": "Maarten Balliauw",
@@ -22,15 +22,15 @@
     ],
     "require": {
         "php": ">=5.2.0",
+        "ext-gd": "*",
         "ext-xml": "*"
     },
-    "recommend": {
-        "ext-zip": "*",
-        "ext-gd2": "*"
+    "suggest": {
+        "ext-zip": "Only needed by PHPExcel_Reader_Excel2007, PHPExcel_Writer_Excel2007, PHPExcel_Reader_OOCalc"
     },
     "autoload": {
         "psr-0": {
-            "PHPExcel": ""
+            "PHPExcel": "Classes/"
         }
     }
 }

@MarkBaker
Copy link
Member

Package has already been registered on packagist.org - https://packagist.org/packages/phpoffice/phpexcel

@MarkBaker
Copy link
Member

"ext-gd": "*", isn't required though, it's only used if you want to use the exact method for autosizing column width, or rendering charts as jpg images

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants