Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add documentation for symfony 2.0 installation #21

Merged
merged 2 commits into from

2 participants

@Squazic

I added documentation for how to install for symfony 2.0. The bundle currently doesn't seem to use anything that doesn't work post 2.0, so no need to branch yet.

Another thing I did was point to the official PHPExcel repository, which is constantly updated. I would have done it in the composer file as well, but I didn't want to break anything in case I did it improperly since I'm not able to test it.

You might want to clean up the file structure of the streamwriter repo. The namespace doesn't look terribly pretty in the autoloader.

@liuggio liuggio merged commit f22a1e7 into liuggio:master
@liuggio
Owner

Thanks for this great job.
I created issues for StreamResponse #22 and PHPExcel #23.

Thanks to you I'm going to tag this one as stable 0.9.0
The 1.0.0 will be created when this repo will point to the Official PHPExcel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 27, 2012
  1. @Squazic
  2. @Squazic
This page is out of date. Refresh to see the latest.
Showing with 53 additions and 9 deletions.
  1. +53 −9 README.md
View
62 README.md
@@ -83,6 +83,50 @@ and add the repositories:
new Liuggio\ExcelBundle\LiuggioExcelBundle(),
);
```
+
+## INSTALLATION with deps file
+
+1 Add to the following to your `deps` file, then run `php bin/vendors install`
+
+``` yaml
+[PHPExcel]
+ git=http://github.com/PHPOffice/PHPExcel.git
+ target=/phpexcel
+ version=origin/master
+
+[n3bStreamresponse]
+ git=git://github.com/liuggio/Symfony2-StreamResponse.git
+ target=n3b/src/n3b/Bundle/Util/HttpFoundation/StreamResponse
+
+[LiuggioExcelBundle]
+ git=https://github.com/liuggio/ExcelBundle.git
+ target=/bundles/Liuggio/ExcelBundle
+```
+
+2 Register the namespaces and prefixes in `app/autoload.php`:
+
+``` php
+ $loader->registerNamespaces(array(
+ // ...
+ 'n3b\\Bundle\\Util\\HttpFoundation\\StreamResponse' => __DIR__.'/../vendor/n3b/src',
+ 'Liuggio' => __DIR__.'/../vendor/bundles',
+ ));
+ $loader->registerPrefixes(array(
+ // ...
+ 'PHPExcel' => __DIR__.'/../vendor/phpexcel/Classes',
+ ));
+
+```
+
+
+3 Enable the bundle in `app/AppKernel.php`
+
+``` php
+ $bundles = array(
+ // ...
+ new Liuggio\ExcelBundle\LiuggioExcelBundle(),
+ );
+```
@@ -92,7 +136,7 @@ If you want write
``` php
// create MS Excel5
- $xls_service = $this->get('xls.service_xls5');
+ $excelService = $this->get('xls.service_xls5');
// create pdf
$this->get('xls.service_pdf');
// create MS Excel 2007
@@ -129,28 +173,28 @@ class DefaultController extends Controller
public function indexAction($name)
{
// ask the service for a Excel5
- $xls_service = $this->get('xls.service_xls5');
+ $excelService = $this->get('xls.service_xls5');
// or $this->get('xls.service_pdf');
// or create your own is easy just modify services.yml
// create the object see http://phpexcel.codeplex.com documentation
- $xls_service->excelObj->getProperties()->setCreator("Maarten Balliauw")
+ $excelService->excelObj->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2005 XLSX Test Document")
->setSubject("Office 2005 XLSX Test Document")
->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.")
->setKeywords("office 2005 openxml php")
->setCategory("Test result file");
- $xls_service->excelObj->setActiveSheetIndex(0)
+ $excelService->excelObj->setActiveSheetIndex(0)
->setCellValue('A1', 'Hello')
->setCellValue('B2', 'world!');
- $xls_service->excelObj->getActiveSheet()->setTitle('Simple');
+ $excelService->excelObj->getActiveSheet()->setTitle('Simple');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
- $xls_service->excelObj->setActiveSheetIndex(0);
+ $excelService->excelObj->setActiveSheetIndex(0);
//create the response
- $response = $xls_service->getResponse();
+ $response = $excelService->getResponse();
$response->headers->set('Content-Type', 'text/vnd.ms-excel; charset=utf-8');
$response->headers->set('Content-Disposition', 'attachment;filename=stdream2.xls');
@@ -168,11 +212,11 @@ With the right writer (e.g. PHPExcel_Writer_Excel5) you could also write the out
public function indexAction($name)
{
- $xls_service = $this->get('xls.service_xls5');
+ $excelService = $this->get('xls.service_xls5');
//...create php excel object
- $xls_service->getStreamWriter()->write( $filename );
+ $excelService->getStreamWriter()->write( $filename );
}
```
Something went wrong with that request. Please try again.