Now I'm working with a big project written on PHP + YII framework.
Now there is a task where it is required to import data from a big json-file into the database.
I'm afraid that this process would take several dozen of minutes or even several hours, so it wouldn't have time to complete during one http-request.
Could you clarify me, if you have worked with YII Framework, how I could solve this problem?
For example, in Drupal there is Batch API, that can allow split a big operation into several small ones.
Are there any similar solution in YII Framework?
Or maybe is there an external PHP library/framework for that?
Thanks in advance.
You could create a yii\console\Controller that can be run from cli (c.f. https://www.yiiframework.com/doc/api/2.0/yii-console-controller)
To split the operation into smaller pieces you could use yii-queue (c.f. https://github.com/yiisoft/yii-queue)
Related
I am a student and I'm making a project, an application which will show data to users on web end and also on android application. but I am confuse which one to choose for backend development, Laravel or Lumen ? My application will have signup function and displayed data from mysql against search queries. There will be 4 to 5 tables and multiple columns in each table. also images to show. So which one I should choose?
From what you have described so far Laravel seems like a perfect fit. Start off with laravel, if you need more speed and a framework focused towards building web services give lumen a try. If you haven't worked with PHP or any other backend app before, go with vanilla PHP.
Goodluck with the app!
If you only need to build an API use Lumen, otherwise Laravel
Well, I recommend Laravel rather than Lumen (Frankly speaking, CI framework may be more suitable, which is simpler and friendly to new user). About 1.5 years ago, I experienced the same dilemma, just like you. For lacking of enough document, I have to migrate my project from Lumen to Laravel when I came across some problems.
I am in the process of integrating some sort of background service executor. I am thinking to use Beanstalkd for it. I Googled it everywhere but I could not find a decent bundle to do the job with nice documentation. Few I found were
LeezyPheanstalkBundle
drymek/pheanstalk-bundle
But these bundles do not describe everything from start to end like this one from Laravel. Like listening for the job, sending arguments and so forth.
Is there any bundle for this or perhaps documentation? I found one nice one for Laravel with proper documentation and everything.
So, I am thinking if I chose to Laravel container for this job are there any tutorials regarding how to use Symfony bundles in Laravel. I found many for using Symfony bundles in Laravel but not the vice versa.
Can someone please give me any insight in this matter.
Working with Beanstalkd is framework agnostic. You should be better and more easy for anyone if you would learn Pheanstalkd library. You can install quickly with Composer.
Working with Beanstalkd is so simple that the two examples from the linked page covers most of the parts, the other more advanced stuff is also easy and at hand with a couple of function calls. You need to be clear with the procotol
I'm looking for a decent example of creating a PHP class that will handle connections to multiple MongoDB databases. I'm working on a project that will have at least five separate databases. It would be extremely process heavy if I were to connect/disconnect each time I make a call to the database.
Can anyone point me in the right direction?
Check out Doctrine2 with it's MongoDB Features
When this project is large and will be maintained for some time, you should also consider taking a framework like Symfony2 into account, which harmonies perfectly with Doctrine2. Though it might feels like a huge rock to climb at the beginning, it is worth the reading and once you're into it, you are not going to make a website manually by hand anymore :)
I currently have an application that is built w/ PHP/MySQL using the Laravel Framework. I want to migrate this application over to Ruby on Rails but I total teardown/rebuild is not feasible. I am wondering how easily it would be to have a PHP application and a Rails application coexisting together and slowly migrating the code over.
Has anyone out there attempted this? If so, what are some noteworthy things that might be of use to me?
There is nothing that comes to my mind that would stop you from doing this. As long as you are ensuring consistency in your database all the time it should not be a problem.
The most challenging task from my experience is to work around conventions in Rails, the naming of tables and columns for example. This is needed if you want to keep the database schema and it doesn't fit accidentally.
I'm planning to use a PHP framework (Yii) for my future project due to the amount of features that it would contain. I have done a few PHP projects in the past and I now realize how disorganized they can get after a while, even if you use a proper directory structure. So, basically, I'm wondering if everything in PHP, can also be done in a framework without tweaking the core framework itself. Will there be any limits? Can I use PHP classes like geolocation, phpexcel or phpthumb: http://phpthumb.gxdlabs.com? Preferably Yii. Thank you!
I'm wondering if everything in PHP, can also be done in a framework without tweaking the core framework itsel
No, every framework has its limits but some are more flexible than others. For example, some frameworks don't allow you to connect to multiple data-sources with their model implementation. But if it's a decent framework, you should be able to extend or swap out those shortcomings with your own or another implementation.
Can I use PHP classes like geolocation, phpexcel or phpthumb
Yes, most frameworks allow easy integration with other libraries. I found a link showing how to integrate phpexcel with Yii:
http://www.yiiframework.com/wiki/101/how-to-use-phpexcel-external-library-with-yii/
Yes All framworks have proscons, but it's very important that how we will user them, i.e cakephp provide the helper class to create html and form but no need to use each and every time that because it will make slow your application
CakePHP have also cache memory limitation, we found in one popular auction script.