Symfony project using CURL - building project with API - php

I have never used a PHP framework before and am considering using Symfony for my next one. However, I have already built an API which has all my main classes. I will therefore connect to this API using CURL. Can anyone advise on where to start with such a project. I am working through a Symfony tutorial but none of it seems to apply to what I need to do as I do not need to create database connections or classes as I will be building this project on my existing API.

If you don't need a lot of what you see in the Symfony tutorials you might be able to get away with Silex. Silex is a mini-framework with alot of the core aspects of Symfony, but without the extra stuff.
http://silex.sensiolabs.org/

Related

Laravel is great but... where's the consideration for HATEOAS?

I've begun using Laravel 5.4 instead of Spring boot for a web application I'm currently developing and it's going great. I'm really enjoying the lack of verbose boilerplate that Java/Spring has. However, one of my requirements is that the API must be HATEOAS.
I've literally searched for days for research material and only come up with a couple of not-so-popular libraries. Is there a reason for this complete lack of exposure of HATEOAS for Laravel when for other web application frameworks there's at least some material?
Edit: I'm not trying to talk down on Laravel, I just want to know why there's no resource on HATEOAS implementations with Laravel as the framework, or if I've missed it, where I can read up on some HATEOAS Laravel goodness.
Since Laravel uses the Symfony underneath, I think this repo would work: https://github.com/willdurand/Hateoas

Laravel 5 and Quickbooks

I'm trying to integrate the Quickbooks Online API into Laravel 5. I've got the code working outside of Laravel using the Consolibyte package. But its written in what I'll call a classic PHP style - meaning there are a number of REQUIRE_ONCE files etc. I'm sure I can crank through and integrate it all, but in the interest of saving time, I'm wondering if anyone else knows of a package for Laravel 5 which already does this?
Ultimately I need to be able to create Customers, Vendors and Invoices. Don't really need the rest of the functionality that the Consolibyte package uses (which is a great package by the way).
If you're using this code:
https://github.com/consolibyte/quickbooks-php
You only need to require one file. There's no real work required to get this working in Laravel. Just do this in your Laravel app:
require_once './QuickBooks.php';
And you're done.
For anyone else looking to solve this problem, this obscure blog post will save your life. It's a lot to post here, but he essentially uses the consolibyte/quickbooks-php, but wraps it up in creamy Laravel goodness so you can see the "under the hood" objects you need to set up so that you don't break the framework.
I followed the instructions, with some alterations for my app, and it authorized first try (Laravel 5.2).
It's not perfect, but it's as clean as you can get for Laravel right now.
Major props to both the article writer Pawan and the package author Keith Palmer Jr!
You can use this one instead its fully enabled to be installed by composer in Laravel or Yii2. I installed it in Yii2.
https://github.com/beanworks/quickbooks-online-v3-sdk install quickbooks from this url and then use the below url to implement oauth
https://github.com/IntuitDeveloper/oauth-php
You can easily make routes for oauth steps involved and there are samples in the later repo which can be used to learn how to post and query objects from quickbook.

Using Codeigniter in Zf2

I have an project that is used by many users and it's written in Codeigniter. I'm very happy with my application but I'm getting lost with Codeigniter because of the functionality of the framework and my application is getting too big for Codeigniter (that is what I think).
I want to go from Codeigniter to Zend, but the application is too big to begin all over again because there is still more functionality to come.
I don't know if someone has experienced or tried it, but does anybody know if it is possible to integrate Codeigniter into Zend as an module and migrate in steps to the Zend Framework 2?
Sorry for my bad english by the way :-)
Having experience with small and medium-scale projects with both CodeIgniter (CI) and Zend Framework (ZF), I can tell you that using one framework over the other will not solve any problem you might be having.
If you are looking for the added functionality provided by the ZF components, such as a ready-made class for Date or the Form verification class, know that you can use ZF components in Code Igniter. You will need to create a special class in CI that will jumpstart the ZF class autoloader. From there you can simply include ZF classes and use them as if you were inside a ZF application.
See http://www.beyondcoding.com/2008/02/21/using-zend-framework-with-codeigniter/ and http://fr.slideshare.net/samsonasik/codeigniter-using-third-party-components-zend-framework-components for more details.
"Integrate" means you want to put your app running on CodeIgniter withing ZendFramework. So basically you changed nothing and there's no much sense of doing so.
You perhaps could consider porting your app from CI to ZF, but that will require rewriting of your code. But I'd first try to find out what the bottleneck in your app really is and ensure that you will benefit from the switch

Getting a list of REST resources from Slim

I'm using the PHP Slim Framework for my RESTful project.
I was wondering if its possible to get a list of all the callback registered with Slim somehow so as to have a list of all the REST resources that are available for the app?
I assume this will involve some sort of pre-compile but I'm not sure how to do it.
I haven't used the Slim Framework yet (looks quite exciting, thanks for the pointer), but my best guess would be using PHPDocumentor to generate documentation about your rest endpoints.
You can find it at the phpdocumentor website

Which MongoDB library to use for a stand-alone PHP project with Symfony?

I am leading a new project where we're convinced that MongoDB is the right choice for database. We have decided that the architecture would be SOA, so the web part will be developed using Symfony and the service part will be developed using light-weight REST framework Tonic.
Now, in the service part, we'll be communicating with MongoDB and for that, we have looked into a number of available MongoDB libraries: Doctrine MongoDB ODM, Mondango, ActiveMongo, MongoRecord, etc. However, we are not sure which one to pick.
I was wondering if anyone can share their experience with these libraries so that we can make the right choice. Here are some of the properties we consider the library should have:
Plain PHP classes for defining documents (instead of array/config files)
Support for references
Efficiency in operations
Easy to understand API
Looking forward to your views!
Personally I would go with Doctrine2 ODM. Seen as you have already decided on Symfony as your framework for doing the heavy lifting the pair are well aligned as far as I understand. You should be able to use this https://github.com/doctrine/DoctrineMongoDBBundle to integrate the two pretty quickly.
The doctrine setup ticks all the boxes you've set for your project goals and is fairly easy to get working with. Most importantly, it's an active project so bug fixes/features/documentation updates happen fairly regularly.
We use a similar setup, except zend framework instead of Symfony, and we're very happy with the results.
Hope this helps.

Categories