Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Can I use Angular with PHP and MySql?

Hi,

I am new to Angular. As practice I developed a Inventory list where I can Add, Edit, and Delete. Along with that I can do searches.

To save the data I am using Firebase. My Questions is.....Can I save in MySql and fetch from it with Angular? Or Do I save with PHP and fetch with Angular?

If you can how do you do it? You don't have to give full answers. I prefer to find the issues myself.

3 Answers

I have not done anything with Angular, so this is my base understanding from conversations with other programmers. It is possible to work with databases with Angular, but I have no idea how to do it. I can help with PHP, though.

I do not believe that the two are compatible. In the reading I have done on the internet, I believe the best practice is to look at the project you are working on and use the languages that best meet the needs of the project. I would guess that the people that say that would answer that PHP is a better choice for that type of work. But learning Angular and how to that work has value also.

I know that Angular works well with a REST API which can interface directly with a database. For instance, the WP Rest API if you're working with Wordpress. For now, the API exists as a plugin, but they're about to integrate it in to core with the release of 4.4 and 4.5. I'm not sure about frameworks such as Laravel. I know it's definitely possible, though. Just depends on how tightly you want it to work together.

And like Ted mentioned, I would seriously consider if it's even necessary or practical. If you really want to make use of Angular, it might end up being better to work with a full-stack Javascript framework instead of PHP.