

dsv





David Sosa Valdes

Threads: 4

Joined: May 2015

Reputation: Posts: 30Threads: 4Joined: May 2015Reputation: 2 #1



Craftsman is a CLI for Codeigniter 3.0 using Symfony Console component. Provides a number of helpful commands for your use while developing your application.



The generation command provides a variety of generators to speed up your development process:

Controllers



Models



Views



Migrations



Seeds



The seeder command uses a simple method of seeding your database with test data using seed classes.



The migration command shows the possible scenario (up/down) before running the scheme selected, here's a list of useful commands that you can use:

check: display the current migration scheme status.



latest: migrate to the latest version, the migration class will use the very newest migration found in the migration directory.



version: can be used to rollback changes or step forwards programmatically to specific versions.



rollback: rollback the last migration operation



reset: rollback all migrations



refresh: rollback all migrations and run them all again



Demo:







Finally here's the documentation of Craftsman:



https://github.com/CI-Craftsman/CLI Hello community!!Craftsman is a CLI for Codeigniter 3.0 using Symfony Console component. Provides a number of helpful commands for your use while developing your application.Theprovides a variety of generators to speed up your development process:Theuses a simple method of seeding your database with test data using seed classes.Theshows the possible scenario (up/down) before running the scheme selected, here's a list of useful commands that you can use:Demo:Finally here's the documentation of Craftsman: Find Reply

rakibtg





Junior Member

Threads: 18

Joined: Jan 2015

Reputation: Posts: 47Threads: 18Joined: Jan 2015Reputation: 0 #2 Great stuff! Find Reply

dsv





David Sosa Valdes

Threads: 4

Joined: May 2015

Reputation: Posts: 30Threads: 4Joined: May 2015Reputation: 2 #3 (08-18-2015, 11:19 AM) rakibtg Wrote: Great stuff!

Thank you rakibtg!! Thank you Find Reply

dsv





David Sosa Valdes

Threads: 4

Joined: May 2015

Reputation: Posts: 30Threads: 4Joined: May 2015Reputation: 2 #4



Modular Migrations: manage your database scheme's evolution through independent versions of your components.



Example:



Suppose we have our application directory:



Code: +- APPPATH/

| +- migrations/

| | +- 001_add_blog.php

| | +- 002_add_posts.php

And an application library uses a database scheme (like Ion Auth, etc). This migrations reside in:



Code: +- APPPATH

| +- libraries/

| | +- XLib/

| | | +- migrations

| | | | +- 001_add_session.php

| | | | +- 002_add_other_stuff.php

If you're familiar with the



With Craftsman you can run the command:



Code: php vendor/bin/craftsman migration:latest --path="application/libraries/XLib"

And that's all, your migrations are now independent.



In your database you can see that every component have a version assigned:



Code: mysql> SELECT * FROM ci_migrations;



+---------------+---------+

| module | version |

+---------------+---------+

| ci_system | 2 |

| xlib | 2 |

+---------------+---------+

Also you can change the component name stored in the database with the '--name' option:



Code: php vendor/bin/craftsman migration:latest --name="foo" --path="application/libraries/XLib" Craftsman now supports HMVC Environments with a new feature: 'Modular Migrations'.Modular Migrations: manage your database scheme's evolution through independent versions of your components.Example:Suppose we have our application directory:And an application library uses a database scheme (like Ion Auth, etc). This migrations reside in:If you're familiar with the Codeigniter Migration Class , it is imposible to maintain separated migration version files in your application, you need to merge these files in one directory and fix the migration file name.With Craftsman you can run the command:And that's all, your migrations are now independent.In your database you can see that every component have a version assigned:Also you can change the component name stored in the database with the '--name' option: Find Reply

dsv





David Sosa Valdes

Threads: 4

Joined: May 2015

Reputation: Posts: 30Threads: 4Joined: May 2015Reputation: 2 #5 serve command :



Code: php vendor/bin/craftsman serve

Arguments:

--host: The host address to serve the application on (default:localhost).



--port: The port to serve the application on (default: 8000).



--docroot: Set an explicit document root (default: cwd).

Now with Craftsman you can test your application without installing a web server using theArguments: Find Reply

dsv





David Sosa Valdes

Threads: 4

Joined: May 2015

Reputation: Posts: 30Threads: 4Joined: May 2015Reputation: 2 #6



Code: php craftsman console

This will bootstrap your application and start an interactive console. At this point you can interact with your application code and execute queries using your application’s models:



Code: php craftsman console



Craftsman v4.2.1 Console

---------------------------------------------------------------

Codeigniter : $CI

Path: ~/codeigniter/application

---------------------------------------------------------------

Psy Shell v0.7.2 (PHP 7.0.12 — cli) by Justin Hileman

>>> $CI->load->model('foo_model');

=> CI_Loader {#153}

>>> $Foo = $CI->foo_model;

=> Foo_model {#313}

>>> $Foo->find_all();

To quit you can use CTRL-C or by typing exit. Craftsman v4+ comes with a built in REPL command that makes it easy to explore your application in an interactive console. You can start the interactive console using:This will bootstrap your application and start an interactive console. At this point you can interact with your application code and execute queries using your application’s models:To quit you can use CTRL-C or by typing exit. Find Reply

dsv





David Sosa Valdes

Threads: 4

Joined: May 2015

Reputation: Posts: 30Threads: 4Joined: May 2015Reputation: 2 #7



Checkout the new demo!! Find Reply

abmcr





Newbie

Threads: 1

Joined: May 2016

Reputation: Posts: 2Threads: 1Joined: May 2016Reputation: 0 #8



Code: [email protected]:/Applications/MAMP/htdocs/CodeIgniter-3.1.3$ composer require craftsman/cli

Using version ^4.2 for craftsman/cli

./composer.json has been updated

Loading composer repositories with package information

Updating dependencies (including require-dev)

Your requirements could not be resolved to an installable set of packages.



Problem 1

- craftsman/cli 4.2.1 requires codeigniter/framework ~3.0 -> satisfiable by codeigniter/framework[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.1.0, 3.1.1, 3.1.2, 3.1.3].

- craftsman/cli 4.2.5 requires codeigniter/framework ~3.0 -> satisfiable by codeigniter/framework[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.1.0, 3.1.1, 3.1.2, 3.1.3].

- Can only install one of: codeigniter/framework[3.0.0, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.1, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.2, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.3, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.4, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.5, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.6, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.1.0, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.1.1, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.1.2, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.1.3, No version set (parsed as 1.0.0)].

- Installation request for codeigniter/framework No version set (parsed as 1.0.0) -> satisfiable by codeigniter/framework[No version set (parsed as 1.0.0)].

- Installation request for craftsman/cli ^4.2 -> satisfiable by craftsman/cli[4.2.1, 4.2.5].





Installation failed, reverting ./composer.json to its original content. I have a problem with the installation; latest CI vanilla Find Reply

dsv





David Sosa Valdes

Threads: 4

Joined: May 2015

Reputation: Posts: 30Threads: 4Joined: May 2015Reputation: 2 #9 (02-05-2017, 10:08 AM) abmcr Wrote: I have a problem with the installation; latest CI vanilla



Code: [email protected]:/Applications/MAMP/htdocs/CodeIgniter-3.1.3$ composer require craftsman/cli

Using version ^4.2 for craftsman/cli

./composer.json has been updated

Loading composer repositories with package information

Updating dependencies (including require-dev)

Your requirements could not be resolved to an installable set of packages.



Problem 1

- craftsman/cli 4.2.1 requires codeigniter/framework ~3.0 -> satisfiable by codeigniter/framework[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.1.0, 3.1.1, 3.1.2, 3.1.3].

- craftsman/cli 4.2.5 requires codeigniter/framework ~3.0 -> satisfiable by codeigniter/framework[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.1.0, 3.1.1, 3.1.2, 3.1.3].

- Can only install one of: codeigniter/framework[3.0.0, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.1, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.2, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.3, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.4, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.5, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.0.6, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.1.0, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.1.1, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.1.2, No version set (parsed as 1.0.0)].

- Can only install one of: codeigniter/framework[3.1.3, No version set (parsed as 1.0.0)].

- Installation request for codeigniter/framework No version set (parsed as 1.0.0) -> satisfiable by codeigniter/framework[No version set (parsed as 1.0.0)].

- Installation request for craftsman/cli ^4.2 -> satisfiable by craftsman/cli[4.2.1, 4.2.5].





Installation failed, reverting ./composer.json to its original content.



Could you provide your composer.json file please? Could you provide your composer.json file please? Find Reply

cvetan





Newbie

Threads: 3

Joined: Nov 2014

Reputation: Posts: 7Threads: 3Joined: Nov 2014Reputation: 0 #10



I followed docs, and when i try to generate controller for exaple i got error:



Code: PHP Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in /var/www/html/newcms/vendor/craftsman/cli/src/Commands/Serve.php on line 94

PHP Stack trace:

PHP 1. {main}() /var/www/html/newcms/vendor/craftsman/cli/craftsman:0

PHP 2. spl_autoload_call() /var/www/html/newcms/vendor/craftsman/cli/craftsman:32

PHP 3. Composer\Autoload\ClassLoader->loadClass() /var/www/html/newcms/vendor/craftsman/cli/craftsman:32

PHP 4. Composer\Autoload\includeFile() /var/www/html/newcms/vendor/composer/ClassLoader.php:322



Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in /var/www/html/newcms/vendor/craftsman/cli/src/Commands/Serve.php on line 94



Call Stack:

0.0001 241328 1. {main}() /var/www/html/newcms/vendor/craftsman/cli/craftsman:0

0.0127 2461032 2. spl_autoload_call() /var/www/html/newcms/vendor/craftsman/cli/craftsman:32

0.0127 2461080 3. Composer\Autoload\ClassLoader->loadClass() /var/www/html/newcms/vendor/craftsman/cli/craftsman:32

0.0127 2461224 4. Composer\Autoload\includeFile() /var/www/html/newcms/vendor/composer/ClassLoader.php:322 It doesn't work.I followed docs, and when i try to generate controller for exaple i got error: "Well, if crime fighters fight crime and fire fighters fight fire, what do freedom fighters fight?" Find Reply