I would like to know if phalcon php has a tool to create and apply migrations such as django has. I django I create my models and to create the migrations script I just have to type this command: python manage.py makemigrations app_name . And to apply migrations to my project: python manage.py migrate app_name
I would like to know if there is something with the same functinality on phalcon php. I have the phalcon dev tools 2.0.13 and I've been reading about the migration command but as far as I've read I couldn't find such functionality (or I'm not understanding).
Can you help me?
Thanks for any help
I have just found:
phalcon migration generate to create the migration files
phalcon migration run to apply the migration files to the database
Tips: create a .phalcon directory in the root of your project if you get this error message: Error: This command should be invoked inside a Phalcon project directory.
And in you config file set 127.0.0.1 instead of localhost if you get this error: ERROR: SQLSTATE[HY000] [2002] No such file or directory
Related
I've seen answers for this question, but I'm still really confused, because answers say I need to be in my Laravel's project folder, which I thought I had created.
I'm trying to run the command php
php artisan horizon:install
This is the second step in the Laravel installation guide found here: https://laravel.com/docs/7.x/horizon#installation
My directory structure looks like this in my documents folder in Mac OS:
I've tried running the command in the RetimeWeb, vendor, bin, laravel and horizon folders. What am I doing wrong here? Where is an artisan folder supposed to be?
Laravel Horizon is dashboard for managing queues (jobs) in Laravel that supposed to be installed on top of Laravel project.
Based on your directory structure you installed Horizon from composer alone. Now you are trying to run command "php artisan horizon:install" but artisan is a tool from Laravel.
"horizon:install" supposed to copy all assets, configs etc to Laravel project - but again, you do not have any so there is not even where to copy it.
To summary.
Install Laravel.
Install Laravel Horizon.
Do cd until you're in the root folder of your project and run the command again. artisan file is in the root folder of a laravel project
I am learning database migration in Yii2. I am trying to create a new migration class create_news_table using command through composer.
I installed composer globally and running command
yii migrate/create create_news_table
I copied this command from yii2 official site Yii2 Db Migration
But after running command i got this error
Unknown command: migrate\create Did you mean "migrate/create"?
However i have written "migrate/create" not "migrate\create". Then why it is showing this error?
Please try this:
php yii migrate/create create_news_table
I was writing correct syntax. But the problem was with my composer.
I updated composer using composer update command and now it is working.
You have to escape / (slash). Try this:
yii migrate\/create create_news_table
I am quite buzzed with the whole Homestead stuff and how it correlates with an IDE. Let's say I have my PhpStorm installed in ~/Developer/PhpStorm The Homestead is in ~/Developer/Homestead. This is how my YAML file in Homestead looks like:
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Developer/Homestead/workspace
to: /home/vagrant/Code
sites:
- map: helloworld.app
to: /home/vagrant/Code/Laravel/public
variables:
- key: APP_ENV
value: local
So, you see that I have a workspace folder in the Homestead directory.
I also have another directory: ~/Developer/workspace/PHP where I am planning to store my projects, instead of in the Homestead folder.
I installed the Laravel plugin in PhpStorm. And, in order for the Laravel plugin to work in PhpStorm, this generated file is needed. My questions are:
Where exactly should I put the _ide_helper.php file so that PhpStorm works properly with Laravel? Should I paste it in each project or just once somewhere?
Do I have to write a different app name in the YAML sites: map field for every project that I want to be launching atm?
How do I create a new Laravel type project. As when I go for creating a new project in PhpStorm, there are types of which I can choose - should I also have Laravel listed there, because I do not? Because now, when I create a new PHP project - it's completely empty. And I suppose a Laravel project should have some architecture and generated files.
I beg of a simple explanation of all this Laravel + Homestead stuff and Vagrant and how to control my projects, because I am getting very frustrated and I have to start working with these technologies on my Bachelor project soon.
You shouldn't need to put the _ide_helper.php file anywhere manually, it is automatically generated by the Artisan command. For each new project, include the IDE helper in that project's composer.json file:
"require-dev": {
"barryvdh/laravel-ide-helper": "1.*"
}
Add the service provider to the providers array in the config.php file of your Laravel project:
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider'
Then use Artisan to generate the _ide_helper.php file for the project (run this command from the terminal in the root of your Laravel project directory):
php artisan ide-helper:generate
This is all paraphrased from the instructions on the IDE Helper GitHub page. I would recommend following those instructions to also set up your composer.json file to auto-generate a new _ide_helper.php whenever composer updates.
Yes. For each individual Laravel project, you'll need to update your sites mapping in the YAML file. For my projects, I use this scheme (note that you are mapping to the location relative to your Vagrant box):
sites:
- map: local.project.example.com
to: /home/vagrant/Projects/project/public
Then in your Homestead directory, run:
vagrant provision
You will also need to update your hosts file to point to the Vagrant box.
sudo nano /etc/hosts
Add the line:
127.0.0.1 local.project.example.com
Now you should be able to access this Laravel project by hitting: local.project.example.com:8000 in your web browser.
Assuming you followed the Laravel installation instructions, the easiest way is to use the Laravel command in the terminal. To create a new Laravel project called "blog", navigate to ~/Developer/workspace/PHP and run the command:
laravel new blog
I hope the above answers get you started down the right path. The most important thing is to carefully read the Laravel documentation as it covers everything I just did but in much greater detail.
thanks Mike Andersen, you have put me on correct way, but your solution number 1 don't work for me (using Laravel 5).
You have to run "composer update" after making changes to composer.json file. But, when i have doed, i got this error:
barryvdh/laravel-ide-helper v1.2.1 requires phpdocumentor/reflection-docblock dev-master#6d705c1a0f9e2a6d73d2e9ec0e538b9dfaf4315f -> no matching package found.
I have got another solution:
remove line about "barryvdh/laravel-ide-helper" from require array on composer.json file.
run the next line: composer require barryvdh/laravel-ide-helper
Then you can follow the steps proposed by Mike Andersen:
Add the service provider to the providers array in the config.php file of your Laravel project:
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider
Then use Artisan to generate the _ide_helper.php file for the project (run this command from the terminal in the root of your Laravel project directory):
php artisan ide-helper:generate
Open your project on phpStorm and go to: File|Synchronize.
And you will got your laravel project updated with the last version of barryvdh/laravel-ide-helper extension
(More info: https://github.com/barryvdh/laravel-ide-helper)
I am new to the Zend Framework. I just started using ZFTool 2. The documentation says I can create a project by running the command
zf.php create project <path>
When I try to create a project
C:\wamp\www>zf.php create project quickstart
I encounter the following error
Error: I cannot find the autoloader of the application.
Check if C:\wamp\www contains a valid ZF2 application.
All other commands seem to work fine except the above. I wouldn't expect the command to be trying to find the autoloader of the application in my www folder anyway escpecially because am attempting to create a new project
EDIT:
The same thing also happens when i run the command
C:\wamp\www>zf.php version
When you use composer to install zftool then it will auto install into vendor\zendframework\zftool
So that, you only need cd to root of application and then point to folder ztool(example: your application folder that store in c:\xampp\htdocs\zend)
c:\xampp\htdocs\zend> php ./vendor/zendframework/zftool/zf.php version
It will output bellow:
ZFTool - Zend Framework 2 command line Tool
The ZFTool is using Zend Framework 2.5.1
and it'll work for you.
http://rao5s.vn
I am trying to install yii2 in ubuntu.
yii2 migrate command not working
yii migrate
I am getting Below error
php yii /var/www/event-tracking/migrate
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
Could not open input file: yii
After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.
Execute the init command and select dev as environment.
php /path/to/yii-application/init
Create a new database and adjust the components.db configuration in common/config/main-local.php accordingly.
Apply migrations with console command:
yii migrate
or for windows:
php yii migrate
This command should create the table User,and Migration in your database
ref [Yii2 Documentation]
If yii migrate isn't working, you can also try php yii migrate as the yii command is just a PHP file that needs to be run.
This could happen if You clone the project from the git repo.
"yii" is added to .gitignore. Follow the instruction described in yii2 installation - migrate command not working
If You'are lazy of afraid to do it for some reasons, just copy "yii" file and /config/*-local.php files into Your project directory.
For init use following command on windows
c:\php /path of your yii application/init
For migration:
c:\php (path of your yii file which is in your application with file name) migrate
e.x:
c:\ php C:\xampp\htdocs\advanced\php migrate
advanced is a name of application.
you can use
php yii2 migrate
this worked for me
Just had this happen to me, CLI php uses a separate .ini, mine had errors supressed and a config file had a typo I just had to do
php -d display_errors=on yii
et voilĂ
Error i was getting:-
user#mohit-pc:/var/www/html/yii2-app$ yii migrate --migrationPath=#mdm/admin/migrations
Command 'yii' not found, did you mean:
command 'ii' from deb ii
command 'yri' from deb yard
Try: sudo apt install <deb name>
Solution Go to the root of you Project and run the php yii migrate
user#mohit-pc:/var/www/html/yii2-app$ php yii migrate --migrationPath=#mdm/admin/migrations
Yii Migration Tool (based on Yii v2.0.43)
Creating migration history table "migration"...Done.
Total 2 new migrations to be applied:
m140602_111327_create_menu_table
m160312_050000_create_user
Apply the above migrations? (yes|no) [no]:yes
*** applying m140602_111327_create_menu_table
> create table {{%menu}} ... done (time: 0.041s)
*** applied m140602_111327_create_menu_table (time: 0.053s)
*** applying m160312_050000_create_user
> create table {{%user}} ... done (time: 0.034s)
*** applied m160312_050000_create_user (time: 0.050s)
2 migrations were applied.
Migrated up successfully.